import java.util.Date
import java.util.List
import java.util.Random
import org.apache.shiro.crypto.hash.Sha512Hash

import com.mastercard.labs.Bank
import com.mastercard.labs.Budget
import com.mastercard.labs.Target
import com.mastercard.labs.Card
import com.mastercard.labs.Category
import com.mastercard.labs.Country
import com.mastercard.labs.Deal
import com.mastercard.labs.DealController
import com.mastercard.labs.Merchant
import com.mastercard.labs.Redemption
import com.mastercard.labs.Role
import com.mastercard.labs.Transaction
import com.mastercard.labs.User
import com.mastercard.labs.UserCard
import com.mastercard.labs.UserCategory
import com.mastercard.labs.Voucher
import com.mastercard.labs.RewardPoint

class BootStrap {
	def DBS, SC, CITIBANK, RBS, ANZ, OUB, OCBC
	def zd_CARD1, zd_CARD2, zd_CARD3, zd_CARD4, zd_CARD5, hm_CARD1, hm_CARD2, hm_CARD3, hm_CARD4, hm_CARD5, tom_CARD1, tom_CARD2, tom_CARD3, tom_CARD4, tom_CARD5, gy_CARD1, gy_CARD2, gy_CARD3, gy_CARD4, gy_CARD5, zf_CARD1, zf_CARD2, zf_CARD3, zf_CARD4, zf_CARD5, al_card_CARD1, al_card_CARD2, al_card_CARD3, al_card_CARD4, al_card_CARD5
	def ZHONGDE, THOMAS, HAOMIN, ZIFENG, GUOYU, ALVIN
	def FASHION, ELECTRONICS, TRAVEL, FOOD, AUTOMOBILE, GROCERY, LEISURE, BILLS, HEALTH_CARE, INVESTMENT, EDUCATION, BOOK, JEWELERY, ENTERTAINMENT, TRANSPORTATION, UTILITY
	def AUDI, ISETAN, ROBINSON, CONVERSE, ADIDAS, BHG, SAKAE_SUSHI, CITY_CHAIN, STARBUCKS, COFFEE_BEAN, NUS, NTU, SMU, APPLE, SAMSUNG
	def SG, US, CN, AU, FR 
	
	def cal = Calendar.getInstance()
	// Category
	Random ran = new Random()

	def adminRole, userRole //roles 	
	def shiroSecurityService

	def init = { servletContext ->
		setupRole()
		setupUser()
		setupBank()
		setupCountry()
		setupCategory()
		setupMerchant()
		setupDeal()
		setupVoucher()
		setupCard()
		setupTransaction()
		setupRedemption()
	}
	def destroy = {
	}

	// Setup role
	def setupRole() {
		adminRole = Role.findByName('admin')
		if(!adminRole){
			log.info "Setup role: [admin]"
			adminRole = new Role()
			adminRole.name = "admin"
			safelyAddPermission adminRole, "*"
			adminRole.save()
		}
		userRole = Role.findByName('user');
		if(!userRole){
			log.info "Setup role: [user]"
			userRole = new Role()
			userRole.name = "user"
			//safelyAddPermission userRole, "user:*"
			safelyAddPermission userRole, "userCard:*"
			safelyAddPermission userRole, "budget:*"
			safelyAddPermission userRole, "card:*"
			safelyAddPermission userRole, "dashboard:*"
			safelyAddPermission userRole, "redemption:*"
			safelyAddPermission userRole, "rewardPoint:*"
			safelyAddPermission userRole, "target:*"
			safelyAddPermission userRole, "transaction:*"
			safelyAddPermission userRole, "transactionCategory:*"
			safelyAddPermission userRole, "qrcode:*"
			safelyAddPermission userRole, "profile:*" 
			//safelyAddPermission userRole, "voucher:*"
			safelyAddPermission userRole, "redemption:*"
			//safelyAddPermission userRole, "deal:*"
			safelyAddPermission userRole, "report:*"
			userRole.save()
		}
	}
	
	// Setup user
	def setupUser() {
		println "setupUser ..."

		ZHONGDE = new User()
		ZHONGDE.username = "ZHONGDE"
		ZHONGDE.name = "ZHONGDE"
		ZHONGDE.nric = "S1551891Z"
		ZHONGDE.email = "zhongde@gmail.com"
		ZHONGDE.phone = "94231901"
		ZHONGDE.status = User.Status.ACTIVE
		ZHONGDE.addToRoles(userRole)
		ZHONGDE.passwordHash = shiroSecurityService.encodePassword("d")
		ZHONGDE.save()

		THOMAS = new User()
		THOMAS.username = "THOMAS"
		THOMAS.name = "THOMAS"
		THOMAS.nric = "S8002590D"
		THOMAS.email = "thomas.daoxuandung@gmail.com"
		THOMAS.phone = "91816701"
		THOMAS.status = User.Status.ACTIVE
		THOMAS.addToRoles(userRole)
		THOMAS.passwordHash = shiroSecurityService.encodePassword("d")
		THOMAS.save()

		HAOMIN = new User()
		HAOMIN.username = "HAOMIN"
		HAOMIN.name = "HAOMIN"
		HAOMIN.nric = "S8619429E"
		HAOMIN.email = "jaster1350732@gmail.com"
		HAOMIN.phone = "91667101"
		HAOMIN.status = User.Status.ACTIVE
		HAOMIN.addToRoles(adminRole)
		HAOMIN.passwordHash = shiroSecurityService.encodePassword("d")
		HAOMIN.save()

		ZIFENG = new User()
		ZIFENG.username = "ZIFENG"
		ZIFENG.name = "ZIFENG"
		ZIFENG.nric = "S1799472G"
		ZIFENG.email = "happyzhouzifeng@gmail.com"
		ZIFENG.phone = "92435201"
		ZIFENG.status = User.Status.ACTIVE
		ZIFENG.addToRoles(adminRole)
		ZIFENG.passwordHash = shiroSecurityService.encodePassword("d")
		ZIFENG.save()

		GUOYU = new User()
		GUOYU.username = "GUOYU"
		GUOYU.name = "GUOYU"
		GUOYU.nric = "S8573085A"
		GUOYU.email = "guoyucn@gmail.com"
		GUOYU.phone = "84284267"
		GUOYU.mobile = "84284267"
		GUOYU.status = User.Status.ACTIVE
		GUOYU.smsNotification = true
		GUOYU.emailNotification = true
		GUOYU.addToRoles(userRole)
		GUOYU.passwordHash = shiroSecurityService.encodePassword("d")
		GUOYU.save()

		ALVIN = new User()
		ALVIN.username = "ALVIN"
		ALVIN.name = "ALVIN"
		ALVIN.nric = "S6902574I"
		ALVIN.email = "alvinleemj@gmail.com"
		ALVIN.phone = "90677602"
		ALVIN.status = User.Status.ACTIVE
		ALVIN.addToRoles(userRole)
		ALVIN.passwordHash = shiroSecurityService.encodePassword("d")
		ALVIN.save()





		def user = User.findByUsername("USER")
		if(!user){
			log.info "setupUser: [user] as user"
			user = new User()
			user.username = "USER"
			user.name = "user1"
			user.nric = "S1234567D"
			user.email = "user@gmail.com"
			user.phone = "98765432"
			user.status = User.Status.ACTIVE
			user.passwordHash = shiroSecurityService.encodePassword("d")
			user.addToRoles(userRole)
			user.save()
		}
		user = User.findByUsername("ADMIN")
		if(!user){
			log.info "setupUser: [admin] as admin"
			user = new User()
			user.username = "ADMIN"
			user.name = "admin1"
			user.nric = "S1234567D"
			user.email = "admin@gmail.com"
			user.phone = "98765431"
			user.status = User.Status.ACTIVE
			user.passwordHash = shiroSecurityService.encodePassword("d")
			user.addToRoles(adminRole)
			user.save()
		}
		
	}

	//Setup countries
	def setupCountry() {
		println "setupCountry ..."
		
		SG = new Country()
		SG.code = "SG"
		SG.name = "Singapore"
		SG.save()
		
		US = new Country()
		US.code = "US"
		US.name = "United States"
		US.save()

		CN = new Country()
		CN.code = "CN"
		CN.name = "China"
		CN.save()
		
		AU = new Country()
		AU.code = "AU"
		AU.name = "Australia"
		AU.save()
		
		FR = new Country()
		FR.code = "FR"
		FR.name = "France"
		FR.save()
		
	}
	
	// Setup categories
	def setupCategory() {
		println "setupCategory ..."

		FASHION = new Category()
		FASHION.name = "FASHION"
		FASHION.save()

		ELECTRONICS = new Category()
		ELECTRONICS.name = "ELECTRONICS"
		ELECTRONICS.save()

		TRAVEL = new Category()
		TRAVEL.name = "TRAVEL"
		TRAVEL.save()

		FOOD = new Category()
		FOOD.name = "FOOD"
		FOOD.save()

		AUTOMOBILE = new Category()
		AUTOMOBILE.name = "AUTOMOBILE"
		AUTOMOBILE.save()

		GROCERY = new Category()
		GROCERY.name = "GROCERY"
		GROCERY.save()

		LEISURE = new Category()
		LEISURE.name = "LEISURE"
		LEISURE.save()

		BILLS = new Category()
		BILLS.name = "BILLS_NAME"
		BILLS.save()

		HEALTH_CARE = new Category()
		HEALTH_CARE.name = "HEALTH_CARE"
		HEALTH_CARE.save()

		INVESTMENT = new Category()
		INVESTMENT.name = "INVESTMENT"
		INVESTMENT.save()

		EDUCATION = new Category()
		EDUCATION.name = "EDUCATION"
		EDUCATION.save()

		BOOK = new Category()
		BOOK.name = "BOOK"
		BOOK.save()

		JEWELERY = new Category()
		JEWELERY.name = "JEWELERY"
		JEWELERY.save()

		ENTERTAINMENT = new Category()
		ENTERTAINMENT.name = "ENTERTAINMENT"
		ENTERTAINMENT.save()

		TRANSPORTATION = new Category()
		TRANSPORTATION.name = "TRANSPORTATION"
		TRANSPORTATION.save()

		UTILITY = new Category()
		UTILITY.name = "UTILITY"
		UTILITY.save()
	}

	// Setup merchant
	def setupMerchant() {
		println "setupMerchant ..."

		AUDI = new Merchant()
		AUDI.name = "AUDI"
		AUDI.country = FR
		AUDI.logo = "http://www.audi.com.sg/ngw_base/img/audi_logo_print.gif"
		AUDI.contact = "67654321"
		AUDI.categories = null
		AUDI.categories = new ArrayList()
		AUDI.categories.add(AUTOMOBILE)
		AUDI.status = Merchant.Status.ACTIVE
		AUDI.save()
		

		ISETAN = new Merchant()
		ISETAN.name = "ISETAN"
		ISETAN.country = SG
		ISETAN.logo = "https://www.isetan.com.sg/images/application/logo-default-trans.jpg"
		ISETAN.contact = "69838752"
		ISETAN.categories = new ArrayList()
		ISETAN.categories.add(FASHION)
		ISETAN.status = Merchant.Status.ACTIVE
		ISETAN.save()

		ROBINSON = new Merchant()
		ROBINSON.name = "ROBINSON"
		ROBINSON.country = SG
		ROBINSON.logo = "http://www.global-blue.com/incoming/article372.ece/ALTERNATES/w277h119/Logo_Robinsons_Singapore"
		ROBINSON.contact = "69107631"
		ROBINSON.categories = new ArrayList()
		ROBINSON.categories.add(FASHION)
		ROBINSON.status = Merchant.Status.ACTIVE
		ROBINSON.save()

		CONVERSE = new Merchant()
		CONVERSE.name = "CONVERSE"
		CONVERSE.country = US
		CONVERSE.logo = "http://profile.ak.fbcdn.net/hprofile-ak-snc7/c10.10.160.160/418788_10151035692034580_204259835_a.jpg"
		CONVERSE.contact = "60386159"
		CONVERSE.categories = new ArrayList()
		CONVERSE.categories.add(FASHION)
		CONVERSE.status = Merchant.Status.ACTIVE
		CONVERSE.save()

		ADIDAS = new Merchant()
		ADIDAS.name = "ADIDAS"
		ADIDAS.country = US
		ADIDAS.logo = "http://upload.wikimedia.org/wikipedia/commons/thumb/2/20/Adidas_Logo.svg/562px-Adidas_Logo.svg.png"
		ADIDAS.contact = "62984981"
		ADIDAS.categories = new ArrayList()
		ADIDAS.categories.add(FASHION)
		ADIDAS.status = Merchant.Status.ACTIVE
		ADIDAS.save()

		BHG = new Merchant()
		BHG.name = "BHG"
		BHG.country = SG
		BHG.logo = "http://ext.bhgsingapore.com.sg/rewards/assets/bhg_logo_new.png"
		BHG.contact = "60385602"
		BHG.categories = new ArrayList()
		BHG.categories.add(FASHION)
		BHG.status = Merchant.Status.ACTIVE
		BHG.save()

		SAKAE_SUSHI = new Merchant()
		SAKAE_SUSHI.name = "SAKAE_SUSHI"
		SAKAE_SUSHI.country = SG
		SAKAE_SUSHI.logo = "http://sakaesushi.com.sg/images/sakae_sushi_white.png"
		SAKAE_SUSHI.contact = "62592189"
		SAKAE_SUSHI.categories = new ArrayList()
		SAKAE_SUSHI.categories.add(FOOD)
		SAKAE_SUSHI.status = Merchant.Status.ACTIVE
		SAKAE_SUSHI.save()

		CITY_CHAIN = new Merchant()
		CITY_CHAIN.name = "CITY_CHAIN"
		CITY_CHAIN.country = SG
		CITY_CHAIN.logo = "http://farm3.staticflickr.com/2151/2479511599_f9ec8472cc_z.jpg"
		CITY_CHAIN.contact = "63782114"
		CITY_CHAIN.categories = new ArrayList()
		CITY_CHAIN.categories.add(FASHION)	
		CITY_CHAIN.status = Merchant.Status.ACTIVE
		CITY_CHAIN.save()

		STARBUCKS = new Merchant()
		STARBUCKS.name = "STARBUCKS"
		STARBUCKS.country = US
		STARBUCKS.logo = "http://upload.wikimedia.org/wikipedia/en/thumb/d/d3/Starbucks_Corporation_Logo_2011.svg/150px-Starbucks_Corporation_Logo_2011.svg.png"
		STARBUCKS.contact = "62960202"
		STARBUCKS.categories = new ArrayList()
		STARBUCKS.categories.add(FOOD)	
		STARBUCKS.status = Merchant.Status.ACTIVE
		STARBUCKS.save()

		COFFEE_BEAN = new Merchant()
		COFFEE_BEAN.name = "COFFEE BEAN"
		COFFEE_BEAN.country = SG
		COFFEE_BEAN.logo = "http://www.coffeebean.com.sg/coffeebean/images/cbtl_logo.gif"
		COFFEE_BEAN.contact = "69328653"
		COFFEE_BEAN.categories = new ArrayList()
		COFFEE_BEAN.categories.add(FOOD)
		COFFEE_BEAN.status = Merchant.Status.ACTIVE
		COFFEE_BEAN.save()

		NUS = new Merchant()
		NUS.name = "NUS"
		NUS.country = SG
		NUS.logo = "http://www.pharmacy.nus.edu.sg/events/drugdelivery2011/nuslogo.jpg"
		NUS.contact = "68396321"
		NUS.categories = new ArrayList()
		NUS.categories.add(EDUCATION)
		NUS.status = Merchant.Status.ACTIVE
		NUS.save()

		NTU = new Merchant()
		NTU.name = "NTU"
		NTU.country = SG
		NTU.logo = "http://www.ntu.edu.sg/home/d.campolo/ntu_logo.jpg"
		NTU.contact = "69396023"
		NTU.categories = new ArrayList()
		NTU.categories.add(EDUCATION)
		NTU.status = Merchant.Status.ACTIVE
		NTU.save()

		SMU = new Merchant()
		SMU.name = "SMU"
		SMU.country = SG
		SMU.logo = "https://twimg0-a.akamaihd.net/profile_images/1865834853/smu-logo-twitter-300.jpg"
		SMU.contact = "67714205"
		SMU.categories = new ArrayList()
		SMU.categories.add(EDUCATION)
		SMU.status = Merchant.Status.ACTIVE
		SMU.save()

		APPLE = new Merchant()
		APPLE.name = "APPLE"
		APPLE.country = US
		APPLE.logo = "http://www.crunchbase.com/assets/images/resized/0005/4061/54061v1-max-250x250.jpg"
		APPLE.contact = "60290527"
		APPLE.categories = new ArrayList()
		APPLE.categories.add(ELECTRONICS)
		APPLE.status = Merchant.Status.ACTIVE
		APPLE.save()

		SAMSUNG = new Merchant()
		SAMSUNG.name = "SAMSUNG"
		SAMSUNG.country = SG
		SAMSUNG.logo = "http://www.samsung.com/common/img/logo.png"
		SAMSUNG.contact = "69386246"
		SAMSUNG.categories = new ArrayList()
		SAMSUNG.categories.add(ELECTRONICS)
		SAMSUNG.status = Merchant.Status.ACTIVE
		SAMSUNG.save()


	}


	// Setup banks
	def setupBank() {
		println "setupBank ..."

		DBS = new Bank();
		DBS.name = "DBS"
		DBS.country = "Singapore"
		DBS.logo =""
		DBS.save()

		SC = new Bank();
		SC.name = "SC"
		SC.country = "Singapore"
		SC.logo =""
		SC.save()

		CITIBANK = new Bank();
		CITIBANK.name = "CITIBANK"
		CITIBANK.country = "Singapore"
		CITIBANK.logo =""
		CITIBANK.save()

		RBS = new Bank();
		RBS.name = "RBS"
		RBS.country = "Singapore"
		RBS.logo =""
		RBS.save()

		ANZ = new Bank();
		ANZ.name = "ANZ"
		ANZ.country = "Singapore"
		ANZ.logo =""
		ANZ.save()

		OUB = new Bank();
		OUB.name = "OUB"
		OUB.country = "Singapore"
		OUB.logo =""
		OUB.save()

		OCBC = new Bank();
		OCBC.name = "OCBC"
		OCBC.country = "Singapore"
		OCBC.logo =""
		OCBC.save()



	}

	// Setup card and link to user
	def setupCard() {
		println "setupCard ..."


		zd_CARD1 = new Card()
		zd_CARD1.brand = "TELCO"
		zd_CARD1.bank = OUB
		zd_CARD1.holder = "LEE ZHONG DE"
		zd_CARD1.number = "5606952959453580"
		zd_CARD1.expiry = "05/16"
		zd_CARD1.cvv2 = "445"
		zd_CARD1.save()

		zd_CARD2 = new Card()
		zd_CARD2.brand = "MEN CARD"
		zd_CARD2.bank = RBS
		zd_CARD2.holder = "LEE ZHONG DE"
		zd_CARD2.number = "5606952959453581"
		zd_CARD2.expiry = "12/15"
		zd_CARD2.cvv2 = "775"
		zd_CARD2.save()

		zd_CARD3 = new Card()
		zd_CARD3.brand = "LADIES CARD"
		zd_CARD3.bank = OUB
		zd_CARD3.holder = "LEE ZHONG DE"
		zd_CARD3.number = "5606952959453582"
		zd_CARD3.expiry = "07/15"
		zd_CARD3.cvv2 = "977"
		zd_CARD3.save()

		zd_CARD4 = new Card()
		zd_CARD4.brand = "FAMILY CARD"
		zd_CARD4.bank = OUB
		zd_CARD4.holder = "LEE ZHONG DE"
		zd_CARD4.number = "5606952959453583"
		zd_CARD4.expiry = "11/15"
		zd_CARD4.cvv2 = "475"
		zd_CARD4.save()

		zd_CARD5 = new Card()
		zd_CARD5.brand = "TITANIUM"
		zd_CARD5.bank = ANZ
		zd_CARD5.holder = "LEE ZHONG DE"
		zd_CARD5.number = "5606952959453584"
		zd_CARD5.expiry = "05/14"
		zd_CARD5.cvv2 = "925"
		zd_CARD5.save()

		gy_CARD1 = new Card()
		gy_CARD1.brand = "MEN CARD"
		gy_CARD1.bank = ANZ
		gy_CARD1.holder = "GUO YU"
		gy_CARD1.number = "5606952959453585"
		gy_CARD1.expiry = "05/14"
		gy_CARD1.cvv2 = "173"
		gy_CARD1.creditLimit = "1000000".toInteger()
		gy_CARD1.save()

		gy_CARD2 = new Card()
		gy_CARD2.brand = "FAMILY CARD"
		gy_CARD2.bank = OUB
		gy_CARD2.holder = "GUO YU"
		gy_CARD2.number = "5606952959453586"
		gy_CARD2.expiry = "09/15"
		gy_CARD2.cvv2 = "159"
		gy_CARD2.creditLimit = "2000000".toInteger()
		gy_CARD2.save()

		gy_CARD3 = new Card()
		gy_CARD3.brand = "TELCO"
		gy_CARD3.bank = CITIBANK
		gy_CARD3.holder = "GUO YU"
		gy_CARD3.number = "5606952959453587"
		gy_CARD3.expiry = "05/16"
		gy_CARD3.cvv2 = "971"
		gy_CARD3.creditLimit = "3000000".toInteger()
		gy_CARD3.save()

		gy_CARD4 = new Card()
		gy_CARD4.brand = "MEN CARD"
		gy_CARD4.bank = OCBC
		gy_CARD4.holder = "GUO YU"
		gy_CARD4.number = "5606952959453588"
		gy_CARD4.expiry = "03/14"
		gy_CARD4.cvv2 = "162"
		gy_CARD4.creditLimit = "4000000".toInteger()
		gy_CARD4.save()

		gy_CARD5 = new Card()
		gy_CARD5.brand = "MEN CARD"
		gy_CARD5.bank = ANZ
		gy_CARD5.holder = "GUO YU"
		gy_CARD5.number = "5606952959453589"
		gy_CARD5.expiry = "10/16"
		gy_CARD5.cvv2 = "172"
		gy_CARD5.creditLimit = "5000000".toInteger()
		gy_CARD5.save()

		def gy_BUDGET1 = new Budget()
		gy_BUDGET1.type = Budget.Type.INDIVIDUAL
		gy_BUDGET1.budgetType = Budget.BudgetType.WEEKLY
//		gy_BUDGET1.startDate = new Date()
//		gy_BUDGET1.endDate = new Date()
		gy_BUDGET1.user = GUOYU
		gy_BUDGET1.recursive=true
		gy_BUDGET1.amount = 1000
		gy_BUDGET1.card = gy_CARD1
		gy_BUDGET1.emailNotification = true
		gy_BUDGET1.smsNotification = true
		gy_BUDGET1.save()
//		
//		
//		gy_BUDGET1 = new Budget()
//		gy_BUDGET1.budgetType = Budget.BudgetType.WEEKLY
//		gy_BUDGET1.recursive = true
//		gy_BUDGET1.type = Budget.Type.INDIVIDUAL
//		gy_BUDGET1.startDate = new Date()
//		gy_BUDGET1.endDate = new Date()
//		gy_BUDGET1.user = GUOYU
//		gy_BUDGET1.amount = 2000
//		gy_BUDGET1.card = gy_CARD2
//		gy_BUDGET1.emailNotification = true
//		gy_BUDGET1.smsNotification = true
//		gy_BUDGET1.save()
//		
//		gy_BUDGET1 = new Budget()
//		gy_BUDGET1.type = Budget.Type.INDIVIDUAL
//		gy_BUDGET1.budgetType = Budget.BudgetType.MONTHLY
//		gy_BUDGET1.recursive = true
//		gy_BUDGET1.startDate = new Date()
//		gy_BUDGET1.endDate = new Date()
//		gy_BUDGET1.user = GUOYU
//		gy_BUDGET1.amount = 3000
//		gy_BUDGET1.card = gy_CARD3
//		gy_BUDGET1.emailNotification = true
//		gy_BUDGET1.smsNotification = true
//		gy_BUDGET1.save()
//		
//		gy_BUDGET1 = new Budget()
//		gy_BUDGET1.type = Budget.Type.INDIVIDUAL
//		gy_BUDGET1.budgetType = Budget.BudgetType.CUSTOMIZE
//		gy_BUDGET1.startDate = new Date()
//		gy_BUDGET1.endDate = new Date()
//		gy_BUDGET1.user = GUOYU
//		gy_BUDGET1.amount = 4000
//		gy_BUDGET1.card = gy_CARD4
//		gy_BUDGET1.emailNotification = true
//		gy_BUDGET1.smsNotification = true
//		gy_BUDGET1.save()
//		
//		gy_BUDGET1 = new Budget()
//		gy_BUDGET1.type = Budget.Type.ALL
//		gy_BUDGET1.budgetType = Budget.BudgetType.CUSTOMIZE
//		gy_BUDGET1.startDate = new Date()
//		gy_BUDGET1.endDate = new Date()
//		gy_BUDGET1.user = GUOYU
//		gy_BUDGET1.amount = 5000
//		gy_BUDGET1.emailNotification = true
//		gy_BUDGET1.smsNotification = true
//		gy_BUDGET1.save()
//		
//		gy_BUDGET1 = new Budget()
//		gy_BUDGET1.type = Budget.Type.ALL
//		gy_BUDGET1.budgetType = Budget.BudgetType.MONTHLY
//		gy_BUDGET1.startDate = new Date()
//		gy_BUDGET1.endDate = new Date()
//		gy_BUDGET1.user = GUOYU
//		gy_BUDGET1.amount = 4000
//		gy_BUDGET1.emailNotification = true
//		gy_BUDGET1.smsNotification = true
//		gy_BUDGET1.save()
//		
//		def gy_TARGET1 = new Target()
//		gy_TARGET1.type = Target.Type.ALL
//		gy_TARGET1.targetType = Target.TargetType.MONTHLY
//		gy_TARGET1.startDate = new Date()
//		gy_TARGET1.endDate = new Date()
//		gy_TARGET1.user = GUOYU
//		gy_TARGET1.amount = 4000
//		gy_TARGET1.emailNotification = true
//		gy_TARGET1.smsNotification = true
//		gy_TARGET1.save()
		
		UserCategory uc = new UserCategory()
		uc.user = GUOYU
		uc.category = FOOD
		uc.save()
		
		uc = new UserCategory()
		uc.user = GUOYU
		uc.category = TRAVEL
		uc.save()
		
		zf_CARD1 = new Card()
		zf_CARD1.brand = "LADIES CARD"
		zf_CARD1.bank = ANZ
		zf_CARD1.holder = "ZHOU ZI FENG"
		zf_CARD1.number = "5606952959453590"
		zf_CARD1.expiry = "08/15"
		zf_CARD1.cvv2 = "334"
		zf_CARD1.save()

		zf_CARD2 = new Card()
		zf_CARD2.brand = "ART"
		zf_CARD2.bank = ANZ
		zf_CARD2.holder = "ZHOU ZI FENG"
		zf_CARD2.number = "5606952959453591"
		zf_CARD2.expiry = "09/16"
		zf_CARD2.cvv2 = "324"
		zf_CARD2.save()

		zf_CARD3 = new Card()
		zf_CARD3.brand = "MEN CARD"
		zf_CARD3.bank = OUB
		zf_CARD3.holder = "ZHOU ZI FENG"
		zf_CARD3.number = "5606952959453592"
		zf_CARD3.expiry = "08/15"
		zf_CARD3.cvv2 = "190"
		zf_CARD3.save()

		zf_CARD4 = new Card()
		zf_CARD4.brand = "TITANIUM"
		zf_CARD4.bank = OUB
		zf_CARD4.holder = "ZHOU ZI FENG"
		zf_CARD4.number = "5606952959453593"
		zf_CARD4.expiry = "09/16"
		zf_CARD4.cvv2 = "229"
		zf_CARD4.save()

		zf_CARD5 = new Card()
		zf_CARD5.brand = "MEN CARD"
		zf_CARD5.bank = OUB
		zf_CARD5.holder = "ZHOU ZI FENG"
		zf_CARD5.number = "5606952959453594"
		zf_CARD5.expiry = "11/15"
		zf_CARD5.cvv2 = "709"
		zf_CARD5.save()

		// Link to user
		def uczd_CARD1 = new UserCard()
		uczd_CARD1.user = ZHONGDE
		uczd_CARD1.card = zd_CARD1
		uczd_CARD1.save()

		def uczd_CARD2 = new UserCard()
		uczd_CARD2.user = ZHONGDE
		uczd_CARD2.card = zd_CARD2
		uczd_CARD2.save()

		def uczd_CARD3 = new UserCard()
		uczd_CARD3.user = ZHONGDE
		uczd_CARD3.card = zd_CARD3
		uczd_CARD3.save()

		def uczd_CARD4 = new UserCard()
		uczd_CARD4.user = ZHONGDE
		uczd_CARD4.card = zd_CARD4
		uczd_CARD4.save()

		def uczd_CARD5 = new UserCard()
		uczd_CARD5.user = ZHONGDE
		uczd_CARD5.card = zd_CARD5
		uczd_CARD5.save()

		def ucgy_CARD1 = new UserCard()
		ucgy_CARD1.user = GUOYU
		ucgy_CARD1.card = gy_CARD1
		ucgy_CARD1.save()

		def ucgy_CARD2 = new UserCard()
		ucgy_CARD2.user = GUOYU
		ucgy_CARD2.card = gy_CARD2
		ucgy_CARD2.save()

		def ucgy_CARD3 = new UserCard()
		ucgy_CARD3.user = GUOYU
		ucgy_CARD3.card = gy_CARD3
		ucgy_CARD3.save()

		def ucgy_CARD4 = new UserCard()
		ucgy_CARD4.user = GUOYU
		ucgy_CARD4.card = gy_CARD4
		ucgy_CARD4.save()

		def ucgy_CARD5 = new UserCard()
		ucgy_CARD5.user = GUOYU
		ucgy_CARD5.card = gy_CARD5
		ucgy_CARD5.save()




		def uczf_CARD1 = new UserCard()
		uczf_CARD1.user = ZIFENG
		uczf_CARD1.card = zf_CARD1
		uczf_CARD1.save()

		def uczf_CARD2 = new UserCard()
		uczf_CARD2.user = ZIFENG
		uczf_CARD2.card = zf_CARD2
		uczf_CARD2.save()

		def uczf_CARD3 = new UserCard()
		uczf_CARD3.user = ZIFENG
		uczf_CARD3.card = zf_CARD3
		uczf_CARD3.save()

		def uczf_CARD4 = new UserCard()
		uczf_CARD4.user = ZIFENG
		uczf_CARD4.card = zf_CARD4
		uczf_CARD4.save()

		def uczf_CARD5 = new UserCard()
		uczf_CARD5.user = ZIFENG
		uczf_CARD5.card = zf_CARD5
		uczf_CARD5.save()
	}
	
	def setupDeal() {
		println "setupDeal ..."
		def dealAudi1 = new Deal()
		dealAudi1.merchant = AUDI
		dealAudi1.price = 1000
		dealAudi1.title = "Promotion for first 100 Audi customer"
		dealAudi1.categories = [AUTOMOBILE, TRANSPORTATION]
		dealAudi1.imageUrl = "http://3.bp.blogspot.com/---NWX3jqfmc/Tg3wrUXVy1I/AAAAAAAAACw/xztoG5WRTmo/s1600/Maybank+credit+card+promotion.JPG"
		dealAudi1.description = "description"
		dealAudi1.detailUrl = "http://www.audi.com.sg/"
		dealAudi1.country = SG
		dealAudi1.startDate = new Date() 
		dealAudi1.endDate = new Date() + (1 + ran.nextInt(30))
		dealAudi1.tags = "Audi, Promotion"
		
		dealAudi1.save()
		
		def dealIsetan1 = new Deal()
		dealIsetan1.merchant = ISETAN
		dealIsetan1.price = 50
		dealIsetan1.title = "Shopping voucher, worth \$70"
		dealIsetan1.categories = [FASHION, GROCERY, UTILITY]
		dealIsetan1.imageUrl = "http://www.shoppingnsales.com/wp-content/uploads/2009/02/20090227-isetan-sale.jpg"
		dealIsetan1.description = "description"
		dealIsetan1.detailUrl = "https://www.isetan.com.sg/"
		dealIsetan1.country = SG
		dealIsetan1.startDate = new Date() 
		dealIsetan1.endDate = new Date() + (1 + ran.nextInt(30))
		dealIsetan1.tags = "Isetan, Promotion"
		dealIsetan1.save()
		
		def dealRob = new Deal()
		dealRob.merchant = ROBINSON
		dealRob.price = 100
		dealRob.title = "Enjoy shopping for Christmas"
		dealRob.categories = [FASHION]
		dealRob.imageUrl = "http://sphotos-c.ak.fbcdn.net/hphotos-ak-ash3/17734_563477980345042_597077989_n.jpg"
		dealRob.description = "description"
		dealRob.detailUrl = "http://www.robinsons.com.sg/"
		dealRob.country = SG
		dealRob.startDate = new Date() 
		dealRob.endDate = new Date() + (1 + ran.nextInt(30))
		dealRob.tags = "Robinson, Promotion"
		dealRob.save()
		
		def dealConverse = new Deal()
		dealConverse.merchant = CONVERSE
		dealConverse.price = 30
		dealConverse.title = "Shopping voucher"
		dealConverse.categories = [FASHION]
		dealConverse.imageUrl = "http://lh5.ggpht.com/_X9_qmS-o_Pc/TQeRUHBNS6I/AAAAAAAACwo/bYr_Fum5Vnc/Converse-Warehouse-Sale%5B13%5D.jpg?imgmax=800"
		dealConverse.description = "description"
		dealConverse.detailUrl = "http://www.converse.com/"
		dealConverse.country = SG
		dealConverse.startDate = new Date() 
		dealConverse.endDate = new Date() + (1 + ran.nextInt(30))
		dealConverse.tags = "Converse, Promotion"
		dealConverse.save()
		
		def dealAdidas = new Deal()
		dealAdidas.merchant = ADIDAS
		dealAdidas.price = 99
		dealAdidas.title = "New shoes for half original price. Limited time only!"
		dealAdidas.categories = [FASHION]
		dealAdidas.imageUrl = "http://myfrugaladventures.com/wp-content/uploads/2011/12/adidas-coupon.jpg"
		dealAdidas.description = "description"
		dealAdidas.detailUrl = "http://www.adidas.com/"
		dealAdidas.country = SG
		dealAdidas.startDate = new Date() 
		dealAdidas.endDate = new Date() + (1 + ran.nextInt(30))
		dealAdidas.tags = "Adidas, PromendDate"
		
		def dealBhg = new Deal()
		dealBhg.merchant = BHG
		dealBhg.price =  70
		dealBhg.title = "Exclusive for first 100 customers"
		dealBhg.categories = [FASHION, UTILITY]
		dealBhg.imageUrl = "http://sgchillout.com/wp-content/uploads/2012/01/BHG-Chinese-New-Year-Sales-2012.jpg"
		dealBhg.description = "description"
		dealBhg.detailUrl = "http://www.bhgsingapore.com.sg/"
		dealBhg.country = SG
		dealBhg.startDate = new Date() 
		dealBhg.endDate = new Date() + (1 + ran.nextInt(30))
		dealBhg.tags = "BHG, Promotion"
		dealBhg.save()
		
		def dealSakae = new Deal()
		dealSakae.merchant = SAKAE_SUSHI
		dealSakae.price = 20
		dealSakae.title = "Enjoy buffet for \$20 only"
		dealSakae.categories = [FOOD]
		dealSakae.imageUrl = "http://sgchillout.com/wp-content/uploads/2012/10/Sakae-Sushi-Sakae-Signatures-Promotion.jpg"
		dealSakae.description = "description"
		dealSakae.detailUrl = "http://sakaesushi.com.sg/"
		dealSakae.country = SG
		dealSakae.startDate = new Date() 
		dealSakae.endDate = new Date() + (1 + ran.nextInt(30))
		dealSakae.tags = "SAKAE, SUSHI, Promotion"
		dealSakae.save()
		
		def dealCity = new Deal()
		dealCity.merchant = CITY_CHAIN
		dealCity.price = 200
		dealCity.title = "Latest Seiko model"
		dealCity.categories = [JEWELERY, TRAVEL, ELECTRONICS]
		dealCity.imageUrl = "http://sg.takemetocbd.com/wp-content/uploads/city-chain-natl-day-promo.jpg"
		dealCity.description = "description"
		dealCity.detailUrl = "http://www.citychain.com/"
		dealCity.country = SG
		dealCity.startDate = new Date() 
		dealCity.endDate = new Date() + (1 + ran.nextInt(30))
		dealCity.tags = "Citychain, Promotion"
		dealCity.save()
		
		def dealSb = new Deal()
		dealSb.merchant = STARBUCKS
		dealSb.price = 10
		dealSb.title = "Enjoy one complimentary cup"
		dealSb.categories = [FOOD, LEISURE]
		dealSb.imageUrl = "http://i.usatoday.net/communitymanager/_photos/pop-candy/2010/11/17/starx-large.jpg"
		dealSb.description = "description"
		dealSb.detailUrl = "http://www.starbucks.com.sg/"
		dealSb.country = SG
		dealSb.startDate = new Date() 
		dealSb.endDate = new Date() + (1 + ran.nextInt(30))
		dealSb.tags = "Starbucks, Promotion"
		dealSb.save()
		
		def dealCoffeeBean = new Deal()
		dealCoffeeBean.merchant = COFFEE_BEAN
		dealCoffeeBean.price = 15
		dealCoffeeBean.title = "Enjoy breakfast at half price"
		dealCoffeeBean.categories = [FOOD, LEISURE]
		dealCoffeeBean.imageUrl = "http://cdn6.everydayonsales.com/wp-content/uploads/2010/11/coffee-Bean-Promotion_thumb.jpg"
		dealCoffeeBean.description = "description"
		dealCoffeeBean.detailUrl = "http://www.coffeebean.com.sg/"
		dealCoffeeBean.country = SG
		dealCoffeeBean.startDate = new Date() 
		dealCoffeeBean.endDate = new Date() + (1 + ran.nextInt(30))
		dealCoffeeBean.tags = "Coffee, Promotion"
		dealCoffeeBean.save()
		
		def dealNus = new Deal()
		dealNus.merchant = NUS
		dealNus.price = 35
		dealNus.title = "Graduation bundle at half price"
		dealNus.categories = [EDUCATION, BOOK]
		dealNus.imageUrl = "http://www.nus.org.uk//_Handlers/ImageGalleryHandler.ashx?imageId=12391&width=323&height=236&overlay=0"
		dealNus.description = "description"
		dealNus.detailUrl = "http://www.nus.edu.sg/"
		dealNus.country = SG
		dealNus.startDate = new Date() 
		dealNus.endDate = new Date() + (1 + ran.nextInt(30))
		dealNus.tags = "NUS, Promotion"
		dealNus.save()

		def dealNtu = new Deal()
		dealNtu.merchant = NTU
		dealNtu.price = 50
		dealNtu.title = "Career workshop bundle at half price"
		dealNtu.categories = [EDUCATION, BOOK]
		dealNtu.imageUrl = "http://www3.ntu.edu.sg/healthylifestyle/images/NTUlogo.jpg"
		dealNtu.description = "description"
		dealNtu.detailUrl = "http://www.ntu.edu.sg/"
		dealNtu.country = SG
		dealNtu.startDate = new Date() 
		dealNtu.endDate = new Date() + (1 + ran.nextInt(30))
		dealNtu.tags = "NTU, Promotion"
		dealNtu.save()
		
		def dealSmu = new Deal()
		dealSmu.merchant = SMU
		dealSmu.price = 85
		dealSmu.title = "Makeup bundle at half price"
		dealSmu.categories = [EDUCATION, BOOK]
		dealSmu.imageUrl = "http://www.smu.edu/~/media/Site/Simmons/Research/RME/images/ED-BANNER.ashx"
		dealSmu.description = "description"
		dealSmu.detailUrl = "http://www.smu.edu.sg/"
		dealSmu.country = SG
		dealSmu.startDate = new Date() 
		dealSmu.endDate = new Date() + (1 + ran.nextInt(30))
		dealSmu.tags = "SMU, Promotion"
		dealSmu.save()
		
		def dealApple1 = new Deal()
		dealApple1.merchant = APPLE
		dealApple1.price = 1200
		dealApple1.title = "Macbook for students"
		dealApple1.categories = [ELECTRONICS, ENTERTAINMENT]
		dealApple1.imageUrl = "http://blog.brightcove.com/sites/all/uploads/apple%20promotion.png"
		dealApple1.description = "description"
		dealApple1.detailUrl = "http://www.apple.com.sg/"
		dealApple1.country = SG
		dealApple1.startDate = new Date() 
		dealApple1.endDate = new Date() + (1 + ran.nextInt(30))
		dealApple1.tags = "Apple, Macbook, Promotion"
		dealApple1.save()
		
		def dealSamsung = new Deal()
		dealSamsung.merchant = SAMSUNG
		dealSamsung.price = 705
		dealSamsung.title = "Offer for S3 Galaxy"
		dealSamsung.categories = [ELECTRONICS, ENTERTAINMENT, UTILITY]
		dealSamsung.imageUrl = "http://www.bigcommunications.co.uk/wp-content/uploads/2011/10/samsung_756x398.jpg"
		dealSamsung.description = "description"
		dealSamsung.detailUrl = "http://www.samsung.com/"
		dealSamsung.country = SG
		dealSamsung.startDate = new Date() 
		dealSamsung.endDate = new Date() + (1 + ran.nextInt(30))
		dealSamsung.tags = "Samsung, Promotion"
		dealSamsung.save()		
	}

	def setupVoucher() {
		println "setupVoucher ..."
		def dealAudi1 = new Voucher()
		dealAudi1.merchant = AUDI
		dealAudi1.totalQuantity = 1000
		dealAudi1.title = "Promotion for first 100 Audi customer"
		dealAudi1.categories = [BILLS, BOOK, TRAVEL]
		dealAudi1.imageUrl = "http://www.staffordaudi.co.uk/Images/vouchers/voucher-stafford-sale.jpg"
		dealAudi1.description = "description"
		dealAudi1.country = SG
		dealAudi1.startDate = new Date() 
		dealAudi1.endDate = new Date() + (1 + ran.nextInt(30))
		dealAudi1.rdptPoint = 100
		
		dealAudi1.save()
		
		def dealIsetan1 = new Voucher()
		dealIsetan1.merchant = ISETAN
		dealIsetan1.country = SG
		dealIsetan1.title = "Shopping voucher, worth \$70"
		dealIsetan1.categories = [BILLS, BOOK, TRAVEL]
		dealIsetan1.imageUrl = "http://shelovesblogging.files.wordpress.com/2011/01/20110117-173309.jpg"
		dealIsetan1.description = "description"
		dealIsetan1.country = SG
		dealIsetan1.startDate = new Date() 
		dealIsetan1.endDate = new Date() + (1 + ran.nextInt(30))
		dealIsetan1.rdptPoint = 100
		dealIsetan1.totalQuantity = 1000
		dealIsetan1.save()
		
		def dealRob = new Voucher()
		dealRob.merchant = ROBINSON
		dealRob.title = "Enjoy shopping for Christmas"
		dealRob.country = SG
		dealRob.categories = [BILLS, BOOK, TRAVEL]
		dealRob.imageUrl = "http://www.marksandspencer.com.sg/images/vouchers.gif"
		dealRob.description = "description"
		dealRob.country = SG
		dealRob.startDate = new Date() 
		dealRob.endDate = new Date() + (1 + ran.nextInt(30))
		dealRob.rdptPoint = 100
		dealRob.totalQuantity = 1000
		dealRob.save()
		
		def dealConverse = new Voucher()
		dealConverse.merchant = CONVERSE
		dealConverse.rdptPoint = 30
		dealConverse.country = SG
		dealConverse.title = "Shopping voucher"
		dealConverse.categories = [BILLS, BOOK, TRAVEL]
		dealConverse.imageUrl = "http://www.converse.com.sg/images/membership_card.jpg"
		dealConverse.description = "description"
		dealConverse.country = SG
		dealConverse.startDate = new Date() 
		dealConverse.endDate = new Date() + (1 + ran.nextInt(30))
		dealConverse.rdptPoint = 100
		dealConverse.totalQuantity = 1000
		dealConverse.save()
		
		def dealAdidas = new Voucher()
		dealAdidas.merchant = ADIDAS
		dealAdidas.rdptPoint = 99
		dealAdidas.country = SG
		dealAdidas.title = "New shoes for half original rdptPoint. Limited time only!"
		dealAdidas.categories = [BILLS, BOOK, TRAVEL]
		dealAdidas.imageUrl = "http://api.ning.com/files/JzLYU7UTmOAHN88PYvwhUDysIUKAl4dmhqkN3sBZ5tKpUiwt0psIGnMdi12zf3to0Zl4LeBJ4hWDfvxc7Ve3QBWbgfb4Wp6P/adiRunvoucher1.jpg?width=597"
		dealAdidas.description = "description"
		dealAdidas.country = SG
		dealAdidas.startDate = new Date() 
		dealAdidas.endDate = new Date() + (1 + ran.nextInt(30))
		dealAdidas.rdptPoint = 100
		dealAdidas.totalQuantity = 1000
		dealAdidas.save()
		
		def dealBhg = new Voucher()
		dealBhg.merchant = BHG
		dealBhg.rdptPoint =  70
		dealBhg.title = "Exclusive for first 100 customers"
		dealBhg.country = SG
		dealBhg.categories = [BILLS, BOOK, TRAVEL]
		dealBhg.imageUrl = "http://www.sgdeals.com/wp-content/uploads/2010/11/BHG-one-day.jpg"
		dealBhg.description = "description"
		dealBhg.country = SG
		dealBhg.startDate = new Date() 
		dealBhg.endDate = new Date() + (1 + ran.nextInt(30))
		dealBhg.rdptPoint = 100
		dealBhg.totalQuantity = 1000
		dealBhg.save()
		
		def dealSakae = new Voucher()
		dealSakae.merchant = SAKAE_SUSHI
		dealSakae.title = "Enjoy buffet for \$20 only"
		dealSakae.country = SG
		dealSakae.categories = [BILLS, BOOK, TRAVEL]
		dealSakae.imageUrl = "http://bidcaso.com/img/product_images/max/4394076c40d919fa853067f06be9f4d6c8e957d6.png"
		dealSakae.description = "description"
		dealSakae.country = SG
		dealSakae.startDate = new Date() 
		dealSakae.endDate = new Date() + (1 + ran.nextInt(30))
		dealSakae.rdptPoint = 100
		dealSakae.totalQuantity = 1000
		dealSakae.save()
		
		def dealCity = new Voucher()
		dealCity.merchant = CITY_CHAIN
		dealCity.title = "Latest Seiko model"
		dealCity.country = SG
		dealCity.categories = [BILLS, BOOK, TRAVEL]
		dealCity.imageUrl = "http://i124.photobucket.com/albums/p3/pohweijie/img001.jpg"
		dealCity.description = "description"
		dealCity.country = SG
		dealCity.startDate = new Date() 
		dealCity.endDate = new Date() + (1 + ran.nextInt(30))
		dealCity.rdptPoint = 100
		dealCity.totalQuantity = 1000
		dealCity.save()
		
		def dealSb = new Voucher()
		dealSb.merchant = STARBUCKS
		dealSb.title = "Enjoy one complimentary cup"
		dealRob.country = SG
		dealSb.categories = [BILLS, BOOK, TRAVEL]
		dealSb.imageUrl = "http://www.bitterwallet.com/wp-content/uploads/2011/03/Bitterwallet-Starbucks-free-coffee-voucher-March-2011.jpg"
		dealSb.description = "description"
		dealSb.country = SG
		dealSb.startDate = new Date() 
		dealSb.endDate = new Date() + (1 + ran.nextInt(30))
		dealSb.rdptPoint = 100
		dealSb.totalQuantity = 1000
		dealSb.save()
		
		def dealCoffeeBean = new Voucher()
		dealCoffeeBean.merchant = COFFEE_BEAN
		dealCoffeeBean.title = "Enjoy breakfast at half rdptPoint"
		dealCoffeeBean.country = SG
		dealCoffeeBean.categories = [BILLS, BOOK, TRAVEL]
		dealCoffeeBean.imageUrl = "http://www.mrlobang.com/wp-content/uploads/2012/05/The-Coffee-Bean-Tea-Leaf-Free-10-Voucher.jpg"
		dealCoffeeBean.description = "description"
		dealCoffeeBean.country = SG
		dealCoffeeBean.startDate = new Date() 
		dealCoffeeBean.endDate = new Date() + (1 + ran.nextInt(30))
		dealCoffeeBean.rdptPoint = 100
		dealCoffeeBean.totalQuantity = 1000
		dealCoffeeBean.save()
		
		def dealNus = new Voucher()
		dealNus.merchant = NUS
		dealNus.title = "Graduation bundle at half rdptPoint"
		dealNus.country = SG
		dealNus.categories = [BILLS, BOOK, TRAVEL]
		dealNus.imageUrl = "http://thumbs4.ebaystatic.com/d/l225/m/mqaJctfl51Zk0fKfcutYkXQ.jpg"
		dealNus.description = "description"
		dealNus.country = SG
		dealNus.startDate = new Date() 
		dealNus.endDate = new Date() + (1 + ran.nextInt(30))
		dealNus.rdptPoint = 100
		dealNus.totalQuantity = 1000
		dealNus.save()

		def dealNtu = new Voucher()
		dealNtu.merchant = NTU
		dealNtu.title = "Career workshop bundle at half price"
		dealNtu.country = SG
		dealNtu.categories = [BILLS, BOOK, TRAVEL]
		dealNtu.imageUrl = "http://i35.tinypic.com/2dj6t6q.jpg"
		dealNtu.description = "description"
		dealNtu.country = SG
		dealNtu.startDate = new Date() 
		dealNtu.endDate = new Date() + (1 + ran.nextInt(30))
		dealNtu.rdptPoint = 100
		dealNtu.totalQuantity = 1000
		dealNtu.save()
		
		def dealSmu = new Voucher()
		dealSmu.merchant = SMU
		dealSmu.title = "Makeup bundle at half rdptPoint"
		dealSmu.country = SG
		dealSmu.categories = [BILLS, BOOK, TRAVEL]
		dealSmu.imageUrl = "http://t0.gstatic.com/images?q=tbn:ANd9GcTmDMiXlLfNYHl8qQnhLMrAmE5TK_D9HVlD7ARTRecl8-5h_qV6ddklsQ"
		dealSmu.description = "description"
		dealSmu.country = SG
		dealSmu.startDate = new Date() 
		dealSmu.endDate = new Date() + (1 + ran.nextInt(30))
		dealSmu.rdptPoint = 100
		dealSmu.totalQuantity = 1000
		dealSmu.save()
		
		def dealApple1 = new Voucher()
		dealApple1.merchant = APPLE
		dealApple1.title = "Macbook for students"
		dealApple1.country = SG
		dealApple1.categories = [BILLS, BOOK, TRAVEL]
		dealApple1.imageUrl = "http://www.qatarliving.com/files/imagecache/page_480/2012/11/02/405105_101206224304_100.jpg"
		dealApple1.description = "description"
		dealApple1.country = SG
		dealApple1.startDate = new Date() 
		dealApple1.endDate = new Date() + (1 + ran.nextInt(30))
		dealApple1.rdptPoint = 100
		dealApple1.totalQuantity = 1000
		dealApple1.save()
		
		def dealSamsung = new Voucher()
		dealSamsung.merchant = SAMSUNG
		dealSamsung.title = "Offer for S3 Galaxy"
		dealSamsung.categories = [BILLS, BOOK, TRAVEL]
		dealSamsung.imageUrl = "http://3.bp.blogspot.com/-ehWjrexYWrI/T_fWOQDEbvI/AAAAAAAADlU/dXoIY0dU5vM/s1600/icicimakemytrip1000voucher.bmp"
		dealSamsung.description = "description"
		dealSamsung.country = SG
		dealSamsung.startDate = new Date() 
		dealSamsung.endDate = new Date() + (1 + ran.nextInt(30))
		dealSamsung.rdptPoint = 100
		dealSamsung.totalQuantity = 1000
		dealSamsung.save()
	}

	// Setup transaction and link to user
	def setupTransaction() {
		println "setupTransaction ..."


		def txn1 = new Transaction()
		txn1.amount = 173.52
		txn1.card = zd_CARD1
		txn1.type = "S"
		txn1.currency = "SGD"
		cal.set(2012,1 , 21)
		txn1.txnDate = cal.getTime()
		txn1.merchant = SMU
		txn1.description = ""
		txn1.save()

		def txn2 = new Transaction()
		txn2.amount = 616.20
		txn2.card = zd_CARD1
		txn2.type = "S"
		txn2.currency = "SGD"
		cal.set(2012,2 , 24)
		txn2.txnDate = cal.getTime()
		txn2.merchant = BHG
		txn2.description = ""
		txn2.save()

		def txn3 = new Transaction()
		txn3.amount = 931.57
		txn3.card = zd_CARD1
		txn3.type = "S"
		txn3.currency = "SGD"
		cal.set(2012, 3, 26)
		txn3.txnDate = cal.getTime()
		txn3.merchant = COFFEE_BEAN
		txn3.description = ""
		txn3.save()

		def txn4 = new Transaction()
		txn4.amount = 663.21
		txn4.card = zd_CARD1
		txn4.type = "S"
		txn4.currency = "SGD"
		cal.set(2012, 4, 5)
		txn4.txnDate = cal.getTime()
		txn4.merchant = SAMSUNG
		txn4.description = ""
		txn4.save()

		def txn5 = new Transaction()
		txn5.amount = 542.31
		txn5.card = zd_CARD1
		txn5.type = "S"
		txn5.currency = "SGD"
		cal.set(2012,5, 21)
		txn5.txnDate = cal.getTime()
		txn5.merchant = SAKAE_SUSHI
		txn5.description = ""
		txn5.save()

		def txn6 = new Transaction()
		txn6.amount = 462.13
		txn6.card = zd_CARD1
		txn6.type = "S"
		txn6.currency = "SGD"
		cal.set(2012, 6, 11)
		txn6.txnDate = cal.getTime()
		txn6.merchant = CONVERSE
		txn6.description = ""
		txn6.save()

		def txn7 = new Transaction()
		txn7.amount = 929.91
		txn7.card = zd_CARD1
		txn7.type = "S"
		txn7.currency = "SGD"
		cal.set(2012, 7, 22)
		txn7.txnDate = cal.getTime()
		txn7.merchant = BHG
		txn7.description = ""
		txn7.save()

		def txn8 = new Transaction()
		txn8.amount = 454.80
		txn8.card = zd_CARD1
		txn8.type = "S"
		txn8.currency = "SGD"
		cal.set(2012, 8, 11)
		txn8.txnDate = cal.getTime()
		txn8.merchant = CITY_CHAIN
		txn8.description = ""
		txn8.save()

		def txn9 = new Transaction()
		txn9.amount = 983.91
		txn9.card = zd_CARD1
		txn9.type = "S"
		txn9.currency = "SGD"
		cal.set(2012, 9, 17)
		txn9.txnDate = cal.getTime()
		txn9.merchant = CONVERSE
		txn9.description = ""
		txn9.save()

		def txn10 = new Transaction()
		txn10.amount = 690.76
		txn10.card = zd_CARD1
		txn10.type = "S"
		txn10.currency = "SGD"
		cal.set(2012, 9, 5)
		txn10.txnDate = cal.getTime()
		txn10.merchant = SAKAE_SUSHI
		txn10.description = ""
		txn10.save()

		def txn11 = new Transaction()
		txn11.amount = 815.58
		txn11.card = zd_CARD2
		txn11.type = "S"
		txn11.currency = "SGD"
		cal.set(2012,1 , 14)
		txn11.txnDate = cal.getTime()
		txn11.merchant = NTU
		txn11.description = ""
		txn11.save()

		def txn12 = new Transaction()
		txn12.amount = 574.04
		txn12.card = zd_CARD2
		txn12.type = "S"
		txn12.currency = "SGD"
		cal.set(2012, 2, 9)
		txn12.txnDate = cal.getTime()
		txn12.merchant = BHG
		txn12.description = ""
		txn12.save()

		def txn13 = new Transaction()
		txn13.amount = 301.42
		txn13.card = zd_CARD2
		txn13.type = "S"
		txn13.currency = "SGD"
		cal.set(2012, 3, 11)
		txn13.txnDate = cal.getTime()
		txn13.merchant = ROBINSON
		txn13.description = ""
		txn13.save()

		def txn14 = new Transaction()
		txn14.amount = 621.19
		txn14.card = zd_CARD2
		txn14.type = "S"
		txn14.currency = "SGD"
		cal.set(2012, 4, 8)
		txn14.txnDate = cal.getTime()
		txn14.merchant = BHG
		txn14.description = ""
		txn14.save()

		def txn15 = new Transaction()
		txn15.amount = 716.90
		txn15.card = zd_CARD2
		txn15.type = "S"
		txn15.currency = "SGD"
		cal.set(2012, 5, 25)
		txn15.txnDate = cal.getTime()
		txn15.merchant = SMU
		txn15.description = ""
		txn15.save()

		def txn16 = new Transaction()
		txn16.amount = 857.55
		txn16.card = zd_CARD2
		txn16.type = "S"
		txn16.currency = "SGD"
		cal.set(2012, 6, 7)
		txn16.txnDate = cal.getTime()
		txn16.merchant = BHG
		txn16.description = ""
		txn16.save()

		def txn17 = new Transaction()
		txn17.amount = 525.18
		txn17.card = zd_CARD2
		txn17.type = "S"
		txn17.currency = "SGD"
		cal.set(2012, 7 , 22)
		txn17.txnDate = cal.getTime()
		txn17.merchant = STARBUCKS
		txn17.description = ""
		txn17.save()

		def txn18 = new Transaction()
		txn18.amount = 471.81
		txn18.card = zd_CARD2
		txn18.type = "S"
		txn18.currency = "SGD"
		cal.set(2012, 8, 27)
		txn18.txnDate = cal.getTime()
		txn18.merchant = NTU
		txn18.description = ""
		txn18.save()

		def txn19 = new Transaction()
		txn19.amount = 137.76
		txn19.card = zd_CARD2
		txn19.type = "S"
		txn19.currency = "SGD"
		cal.set(2012, 9, 22)
		txn19.txnDate = cal.getTime()
		txn19.merchant = APPLE
		txn19.description = ""
		txn19.save()

		def txn20 = new Transaction()
		txn20.amount = 878.09
		txn20.card = zd_CARD3
		txn20.type = "S"
		txn20.currency = "SGD"
		cal.set(2012, 1, 9)
		txn20.txnDate = cal.getTime()
		txn20.merchant = SMU
		txn20.description = ""
		txn20.save()

		def txn21 = new Transaction()
		txn21.amount = 595.19
		txn21.card = zd_CARD3
		txn21.type = "S"
		txn21.currency = "SGD"
		cal.set(2012, 2, 22)
		txn21.txnDate = cal.getTime()
		txn21.merchant = ROBINSON
		txn21.description = ""
		txn21.save()

		def txn22 = new Transaction()
		txn22.amount = 147.84
		txn22.card = zd_CARD3
		txn22.type = "S"
		txn22.currency = "SGD"
		cal.set(2012, 3, 13)
		txn22.txnDate = cal.getTime()
		txn22.merchant = SAMSUNG
		txn22.description = ""
		txn22.save()

		def txn23 = new Transaction()
		txn23.amount = 979.55
		txn23.card = zd_CARD3
		txn23.type = "S"
		txn23.currency = "SGD"
		cal.set(2012, 4, 10)
		txn23.txnDate = cal.getTime()
		txn23.merchant = CONVERSE
		txn23.description = ""
		txn23.save()

		def txn24 = new Transaction()
		txn24.amount = 478.26
		txn24.card = zd_CARD3
		txn24.type = "S"
		txn24.currency = "SGD"
		cal.set(2012, 5, 23)
		txn24.txnDate = cal.getTime()
		txn24.merchant = SAKAE_SUSHI
		txn24.description = ""
		txn24.save()

		def txn25 = new Transaction()
		txn25.amount = 873.00
		txn25.card = zd_CARD3
		txn25.type = "S"
		txn25.currency = "SGD"
		cal.set(2012, 6, 21)
		txn25.txnDate = cal.getTime()
		txn25.merchant = STARBUCKS
		txn25.description = ""
		txn25.save()

		def txn26 = new Transaction()
		txn26.amount = 905.96
		txn26.card = zd_CARD3
		txn26.type = "S"
		txn26.currency = "SGD"
		cal.set(2012, 7, 14)
		txn26.txnDate = cal.getTime()
		txn26.merchant = ADIDAS
		txn26.description = ""
		txn26.save()

		def txn27 = new Transaction()
		txn27.amount = 835.31
		txn27.card = zd_CARD3
		txn27.type = "S"
		txn27.currency = "SGD"
		cal.set(2012, 8, 7)
		txn27.txnDate = cal.getTime()
		txn27.merchant = BHG
		txn27.description = ""
		txn27.save()

		def txn28 = new Transaction()
		txn28.amount = 129.34
		txn28.card = zd_CARD3
		txn28.type = "S"
		txn28.currency = "SGD"
		cal.set(2012, 9, 14)
		txn28.txnDate = cal.getTime()
		txn28.merchant = APPLE
		txn28.description = ""
		txn28.save()

		def txn29 = new Transaction()
		txn29.amount = 289.97
		txn29.card = gy_CARD2
		txn29.type = "S"
		txn29.currency = "SGD"
		cal.set(2012,10 , 16)
		txn29.txnDate = cal.getTime()
		txn29.merchant = NTU
		txn29.description = ""
		txn29.save()

		def txn30 = new Transaction()
		txn30.amount = 954.08
		txn30.card = gy_CARD2
		txn30.type = "S"
		txn30.currency = "SGD"
		cal.set(2012,4 , 4)
		txn30.txnDate = cal.getTime()
		txn30.merchant = NUS
		txn30.description = ""
		txn30.save()

		def txn31 = new Transaction()
		txn31.amount = 945.21
		txn31.card = gy_CARD3
		txn31.type = "S"
		txn31.currency = "SGD"
		cal.set(2012,8 , 10)
		txn31.txnDate = cal.getTime()
		txn31.merchant = CITY_CHAIN
		txn31.description = ""
		txn31.save()

		def txn32 = new Transaction()
		txn32.amount = 401.27
		txn32.card = gy_CARD1
		txn32.type = "S"
		txn32.currency = "SGD"
		cal.set(2012,5 , 19)
		txn32.txnDate = cal.getTime()
		txn32.merchant = SAKAE_SUSHI
		txn32.description = ""
		txn32.save()

		def txn33 = new Transaction()
		txn33.amount = 585.20
		txn33.card = zf_CARD1
		txn33.type = "S"
		txn33.currency = "SGD"
		cal.set(2012,6 , 22)
		txn33.txnDate = cal.getTime()
		txn33.merchant = STARBUCKS
		txn33.description = ""
		txn33.save()

		def txn34 = new Transaction()
		txn34.amount = 880.82
		txn34.card = gy_CARD1
		txn34.type = "S"
		txn34.currency = "SGD"
		cal.set(2012,8 , 26)
		txn34.txnDate = cal.getTime()
		txn34.merchant = SMU
		txn34.description = ""
		txn34.save()

		def txn35 = new Transaction()
		txn35.amount = 145.91
		txn35.card = gy_CARD1
		txn35.type = "S"
		txn35.currency = "SGD"
		cal.set(2012,3 , 24)
		txn35.txnDate = cal.getTime()
		txn35.merchant = CONVERSE
		txn35.description = ""
		txn35.save()

		def txn36 = new Transaction()
		txn36.amount = 209.37
		txn36.card = zf_CARD2
		txn36.type = "S"
		txn36.currency = "SGD"
		cal.set(2012,4 , 22)
		txn36.txnDate = cal.getTime()
		txn36.merchant = COFFEE_BEAN
		txn36.description = ""
		txn36.save()

		def txn37 = new Transaction()
		txn37.amount = 316.92
		txn37.card = zd_CARD4
		txn37.type = "S"
		txn37.currency = "SGD"
		cal.set(2012,6 , 13)
		txn37.txnDate = cal.getTime()
		txn37.merchant = APPLE
		txn37.description = ""
		txn37.save()

		def txn38 = new Transaction()
		txn38.amount = 811.87
		txn38.card = zd_CARD3
		txn38.type = "S"
		txn38.currency = "SGD"
		cal.set(2012,6 , 19)
		txn38.txnDate = cal.getTime()
		txn38.merchant = CITY_CHAIN
		txn38.description = ""
		txn38.save()

		def txn39 = new Transaction()
		txn39.amount = 251.66
		txn39.card = zf_CARD1
		txn39.type = "S"
		txn39.currency = "SGD"
		cal.set(2012,9 , 17)
		txn39.txnDate = cal.getTime()
		txn39.merchant = STARBUCKS
		txn39.description = ""
		txn39.save()

		def txn40 = new Transaction()
		txn40.amount = 557.18
		txn40.card = gy_CARD2
		txn40.type = "S"
		txn40.currency = "SGD"
		cal.set(2012,3 , 18)
		txn40.txnDate = cal.getTime()
		txn40.merchant = SAMSUNG
		txn40.description = ""
		txn40.save()

		def txn41 = new Transaction()
		txn41.amount = 866.24
		txn41.card = gy_CARD2
		txn41.type = "S"
		txn41.currency = "SGD"
		cal.set(2012,6 , 16)
		txn41.txnDate = cal.getTime()
		txn41.merchant = ADIDAS
		txn41.description = ""
		txn41.save()

		def txn42 = new Transaction()
		txn42.amount = 644.65
		txn42.card = zd_CARD1
		txn42.type = "S"
		txn42.currency = "SGD"
		cal.set(2012,6 , 11)
		txn42.txnDate = cal.getTime()
		txn42.merchant = NTU
		txn42.description = ""
		txn42.save()

		def txn43 = new Transaction()
		txn43.amount = 909.22
		txn43.card = zd_CARD3
		txn43.type = "S"
		txn43.currency = "SGD"
		cal.set(2012,6 , 11)
		txn43.txnDate = cal.getTime()
		txn43.merchant = SMU
		txn43.description = ""
		txn43.save()

		def txn44 = new Transaction()
		txn44.amount = 246.22
		txn44.card = zf_CARD2
		txn44.type = "S"
		txn44.currency = "SGD"
		cal.set(2012,9 , 3)
		txn44.txnDate = cal.getTime()
		txn44.merchant = NTU
		txn44.description = ""
		txn44.save()

		def txn45 = new Transaction()
		txn45.amount = 690.47
		txn45.card = gy_CARD5
		txn45.type = "S"
		txn45.currency = "SGD"
		cal.set(2012,10 , 20)
		txn45.txnDate = cal.getTime()
		txn45.merchant = STARBUCKS
		txn45.description = ""
		txn45.save()

		def txn46 = new Transaction()
		txn46.amount = 769.20
		txn46.card = zf_CARD5
		txn46.type = "S"
		txn46.currency = "SGD"
		cal.set(2012,11 , 27)
		txn46.txnDate = cal.getTime()
		txn46.merchant = STARBUCKS
		txn46.description = ""
		txn46.save()

		def txn47 = new Transaction()
		txn47.amount = 128.15
		txn47.card = gy_CARD2
		txn47.type = "S"
		txn47.currency = "SGD"
		cal.set(2012,11 , 23)
		txn47.txnDate = cal.getTime()
		txn47.merchant = SMU
		txn47.description = ""
		txn47.save()

		def txn48 = new Transaction()
		txn48.amount = 241.65
		txn48.card = zf_CARD1
		txn48.type = "S"
		txn48.currency = "SGD"
		cal.set(2012,6 , 5)
		txn48.txnDate = cal.getTime()
		txn48.merchant = STARBUCKS
		txn48.description = ""
		txn48.save()

		def txn49 = new Transaction()
		txn49.amount = 565.50
		txn49.card = gy_CARD5
		txn49.type = "S"
		txn49.currency = "SGD"
		cal.set(2012,9 , 19)
		txn49.txnDate = cal.getTime()
		txn49.merchant = CITY_CHAIN
		txn49.description = ""
		txn49.save()

		def txn50 = new Transaction()
		txn50.amount = 449.20
		txn50.card = zd_CARD1
		txn50.type = "S"
		txn50.currency = "SGD"
		cal.set(2012,5 , 4)
		txn50.txnDate = cal.getTime()
		txn50.merchant = STARBUCKS
		txn50.description = ""
		txn50.save()

		def txn51 = new Transaction()
		txn51.amount = 930.23
		txn51.card = gy_CARD2
		txn51.type = "S"
		txn51.currency = "SGD"
		cal.set(2012,6 , 6)
		txn51.txnDate = cal.getTime()
		txn51.merchant = SMU
		txn51.description = ""
		txn51.save()

		def txn52 = new Transaction()
		txn52.amount = 614.53
		txn52.card = zf_CARD1
		txn52.type = "S"
		txn52.currency = "SGD"
		cal.set(2012,10 , 4)
		txn52.txnDate = cal.getTime()
		txn52.merchant = SAMSUNG
		txn52.description = ""
		txn52.save()

		def txn53 = new Transaction()
		txn53.amount = 282.74
		txn53.card = gy_CARD2
		txn53.type = "S"
		txn53.currency = "SGD"
		cal.set(2012,4 , 7)
		txn53.txnDate = cal.getTime()
		txn53.merchant = APPLE
		txn53.description = ""
		txn53.save()

		def txn54 = new Transaction()
		txn54.amount = 250.26
		txn54.card = zf_CARD3
		txn54.type = "S"
		txn54.currency = "SGD"
		cal.set(2012,10 , 12)
		txn54.txnDate = cal.getTime()
		txn54.merchant = SMU
		txn54.description = ""
		txn54.save()

		def txn55 = new Transaction()
		txn55.amount = 567.86
		txn55.card = zf_CARD1
		txn55.type = "S"
		txn55.currency = "SGD"
		cal.set(2012,10 , 13)
		txn55.txnDate = cal.getTime()
		txn55.merchant = BHG
		txn55.description = ""
		txn55.save()

		def txn56 = new Transaction()
		txn56.amount = 431.84
		txn56.card = zf_CARD2
		txn56.type = "S"
		txn56.currency = "SGD"
		cal.set(2012,8 , 10)
		txn56.txnDate = cal.getTime()
		txn56.merchant = STARBUCKS
		txn56.description = ""
		txn56.save()

		def txn57 = new Transaction()
		txn57.amount = 898.14
		txn57.card = zd_CARD1
		txn57.type = "S"
		txn57.currency = "SGD"
		cal.set(2012,11 , 15)
		txn57.txnDate = cal.getTime()
		txn57.merchant = COFFEE_BEAN
		txn57.description = ""
		txn57.save()

		def txn58 = new Transaction()
		txn58.amount = 414.82
		txn58.card = gy_CARD5
		txn58.type = "S"
		txn58.currency = "SGD"
		cal.set(2012,9 , 11)
		txn58.txnDate = cal.getTime()
		txn58.merchant = CITY_CHAIN
		txn58.description = ""
		txn58.save()

		def txn59 = new Transaction()
		txn59.amount = 752.35
		txn59.card = gy_CARD5
		txn59.type = "S"
		txn59.currency = "SGD"
		cal.set(2012,4 , 15)
		txn59.txnDate = cal.getTime()
		txn59.merchant = APPLE
		txn59.description = ""
		txn59.save()

		def txn60 = new Transaction()
		txn60.amount = 675.54
		txn60.card = zf_CARD1
		txn60.type = "S"
		txn60.currency = "SGD"
		cal.set(2012,4 , 16)
		txn60.txnDate = cal.getTime()
		txn60.merchant = APPLE
		txn60.description = ""
		txn60.save()

		def txn61 = new Transaction()
		txn61.amount = 738.11
		txn61.card = zf_CARD2
		txn61.type = "S"
		txn61.currency = "SGD"
		cal.set(2012,10 , 6)
		txn61.txnDate = cal.getTime()
		txn61.merchant = CONVERSE
		txn61.description = ""
		txn61.save()

		def txn62 = new Transaction()
		txn62.amount = 186.93
		txn62.card = zf_CARD5
		txn62.type = "S"
		txn62.currency = "SGD"
		cal.set(2012,11 , 16)
		txn62.txnDate = cal.getTime()
		txn62.merchant = COFFEE_BEAN
		txn62.description = ""
		txn62.save()

		def txn63 = new Transaction()
		txn63.amount = 666.61
		txn63.card = gy_CARD1
		txn63.type = "S"
		txn63.currency = "SGD"
		cal.set(2012,7 , 12)
		txn63.txnDate = cal.getTime()
		txn63.merchant = APPLE
		txn63.description = ""
		txn63.save()

		def txn64 = new Transaction()
		txn64.amount = 399.90
		txn64.card = zd_CARD2
		txn64.type = "S"
		txn64.currency = "SGD"
		cal.set(2012,6 , 24)
		txn64.txnDate = cal.getTime()
		txn64.merchant = SMU
		txn64.description = ""
		txn64.save()

		def txn65 = new Transaction()
		txn65.amount = 108.54
		txn65.card = zf_CARD5
		txn65.type = "S"
		txn65.currency = "SGD"
		cal.set(2012,4 , 16)
		txn65.txnDate = cal.getTime()
		txn65.merchant = SMU
		txn65.description = ""
		txn65.save()

		def txn66 = new Transaction()
		txn66.amount = 108.03
		txn66.card = gy_CARD5
		txn66.type = "S"
		txn66.currency = "SGD"
		cal.set(2012,10 , 9)
		txn66.txnDate = cal.getTime()
		txn66.merchant = BHG
		txn66.description = ""
		txn66.save()

		def txn67 = new Transaction()
		txn67.amount = 553.21
		txn67.card = zf_CARD3
		txn67.type = "S"
		txn67.currency = "SGD"
		cal.set(2012,6 , 27)
		txn67.txnDate = cal.getTime()
		txn67.merchant = CONVERSE
		txn67.description = ""
		txn67.save()

		def txn68 = new Transaction()
		txn68.amount = 681.02
		txn68.card = zf_CARD1
		txn68.type = "S"
		txn68.currency = "SGD"
		cal.set(2012,11 , 26)
		txn68.txnDate = cal.getTime()
		txn68.merchant = SMU
		txn68.description = ""
		txn68.save()

		def txn69 = new Transaction()
		txn69.amount = 528.10
		txn69.card = zf_CARD4
		txn69.type = "S"
		txn69.currency = "SGD"
		cal.set(2012,8 , 6)
		txn69.txnDate = cal.getTime()
		txn69.merchant = COFFEE_BEAN
		txn69.description = ""
		txn69.save()

		def txn70 = new Transaction()
		txn70.amount = 570.34
		txn70.card = gy_CARD4
		txn70.type = "S"
		txn70.currency = "SGD"
		cal.set(2012,5 , 18)
		txn70.txnDate = cal.getTime()
		txn70.merchant = CITY_CHAIN
		txn70.description = ""
		txn70.save()

		def txn71 = new Transaction()
		txn71.amount = 170.36
		txn71.card = zd_CARD1
		txn71.type = "S"
		txn71.currency = "SGD"
		cal.set(2012,6 , 8)
		txn71.txnDate = cal.getTime()
		txn71.merchant = APPLE
		txn71.description = ""
		txn71.save()

		def txn72 = new Transaction()
		txn72.amount = 531.24
		txn72.card = zd_CARD3
		txn72.type = "S"
		txn72.currency = "SGD"
		cal.set(2012,7 , 19)
		txn72.txnDate = cal.getTime()
		txn72.merchant = COFFEE_BEAN
		txn72.description = ""
		txn72.save()

		def txn73 = new Transaction()
		txn73.amount = 545.04
		txn73.card = gy_CARD5
		txn73.type = "S"
		txn73.currency = "SGD"
		cal.set(2012,8 , 27)
		txn73.txnDate = cal.getTime()
		txn73.merchant = ADIDAS
		txn73.description = ""
		txn73.save()

		def txn74 = new Transaction()
		txn74.amount = 107.28
		txn74.card = zd_CARD4
		txn74.type = "S"
		txn74.currency = "SGD"
		cal.set(2012,8 , 3)
		txn74.txnDate = cal.getTime()
		txn74.merchant = APPLE
		txn74.description = ""
		txn74.save()

		def txn75 = new Transaction()
		txn75.amount = 905.32
		txn75.card = zf_CARD1
		txn75.type = "S"
		txn75.currency = "SGD"
		cal.set(2012,9 , 10)
		txn75.txnDate = cal.getTime()
		txn75.merchant = COFFEE_BEAN
		txn75.description = ""
		txn75.save()

		def txn76 = new Transaction()
		txn76.amount = 321.16
		txn76.card = zf_CARD1
		txn76.type = "S"
		txn76.currency = "SGD"
		cal.set(2012,8 , 20)
		txn76.txnDate = cal.getTime()
		txn76.merchant = CONVERSE
		txn76.description = ""
		txn76.save()

		def txn77 = new Transaction()
		txn77.amount = 263.70
		txn77.card = zd_CARD2
		txn77.type = "S"
		txn77.currency = "SGD"
		cal.set(2012,6 , 4)
		txn77.txnDate = cal.getTime()
		txn77.merchant = STARBUCKS
		txn77.description = ""
		txn77.save()

		def txn78 = new Transaction()
		txn78.amount = 917.96
		txn78.card = zf_CARD4
		txn78.type = "S"
		txn78.currency = "SGD"
		cal.set(2012,7 , 9)
		txn78.txnDate = cal.getTime()
		txn78.merchant = NUS
		txn78.description = ""
		txn78.save()

		def txn79 = new Transaction()
		txn79.amount = 422.75
		txn79.card = zf_CARD3
		txn79.type = "S"
		txn79.currency = "SGD"
		cal.set(2012,3 , 26)
		txn79.txnDate = cal.getTime()
		txn79.merchant = CITY_CHAIN
		txn79.description = ""
		txn79.save()

		def txn80 = new Transaction()
		txn80.amount = 208.43
		txn80.card = gy_CARD5
		txn80.type = "S"
		txn80.currency = "SGD"
		cal.set(2012,11 , 25)
		txn80.txnDate = cal.getTime()
		txn80.merchant = SAKAE_SUSHI
		txn80.description = ""
		txn80.save()

		def txn81 = new Transaction()
		txn81.amount = 854.77
		txn81.card = zf_CARD1
		txn81.type = "S"
		txn81.currency = "SGD"
		cal.set(2012,4 , 14)
		txn81.txnDate = cal.getTime()
		txn81.merchant = APPLE
		txn81.description = ""
		txn81.save()

		def txn82 = new Transaction()
		txn82.amount = 324.97
		txn82.card = zd_CARD4
		txn82.type = "S"
		txn82.currency = "SGD"
		cal.set(2012,10 , 5)
		txn82.txnDate = cal.getTime()
		txn82.merchant = CITY_CHAIN
		txn82.description = ""
		txn82.save()

		def txn83 = new Transaction()
		txn83.amount = 561.88
		txn83.card = zf_CARD4
		txn83.type = "S"
		txn83.currency = "SGD"
		cal.set(2012,10 , 18)
		txn83.txnDate = cal.getTime()
		txn83.merchant = COFFEE_BEAN
		txn83.description = ""
		txn83.save()

		def txn84 = new Transaction()
		txn84.amount = 876.91
		txn84.card = zd_CARD3
		txn84.type = "S"
		txn84.currency = "SGD"
		cal.set(2012,11 , 27)
		txn84.txnDate = cal.getTime()
		txn84.merchant = CITY_CHAIN
		txn84.description = ""
		txn84.save()

		def txn85 = new Transaction()
		txn85.amount = 942.10
		txn85.card = zd_CARD5
		txn85.type = "S"
		txn85.currency = "SGD"
		cal.set(2012,3 , 19)
		txn85.txnDate = cal.getTime()
		txn85.merchant = BHG
		txn85.description = ""
		txn85.save()

		def txn86 = new Transaction()
		txn86.amount = 445.70
		txn86.card = gy_CARD2
		txn86.type = "S"
		txn86.currency = "SGD"
		cal.set(2012,8 , 13)
		txn86.txnDate = cal.getTime()
		txn86.merchant = SMU
		txn86.description = ""
		txn86.save()

		def txn87 = new Transaction()
		txn87.amount = 183.98
		txn87.card = gy_CARD5
		txn87.type = "S"
		txn87.currency = "SGD"
		cal.set(2012,9 , 24)
		txn87.txnDate = cal.getTime()
		txn87.merchant = STARBUCKS
		txn87.description = ""
		txn87.save()

		def txn88 = new Transaction()
		txn88.amount = 250.13
		txn88.card = gy_CARD2
		txn88.type = "S"
		txn88.currency = "SGD"
		cal.set(2012,6 , 16)
		txn88.txnDate = cal.getTime()
		txn88.merchant = NTU
		txn88.description = ""
		txn88.save()

		def txn89 = new Transaction()
		txn89.amount = 953.26
		txn89.card = gy_CARD4
		txn89.type = "S"
		txn89.currency = "SGD"
		cal.set(2012,3 , 22)
		txn89.txnDate = cal.getTime()
		txn89.merchant = SMU
		txn89.description = ""
		txn89.save()

		def txn90 = new Transaction()
		txn90.amount = 895.26
		txn90.card = gy_CARD1
		txn90.type = "S"
		txn90.currency = "SGD"
		cal.set(2012,9 , 15)
		txn90.txnDate = cal.getTime()
		txn90.merchant = STARBUCKS
		txn90.description = ""
		txn90.save()

		def txn91 = new Transaction()
		txn91.amount = 976.55
		txn91.card = zd_CARD5
		txn91.type = "S"
		txn91.currency = "SGD"
		cal.set(2012,8 , 3)
		txn91.txnDate = cal.getTime()
		txn91.merchant = ROBINSON
		txn91.description = ""
		txn91.save()

		def txn92 = new Transaction()
		txn92.amount = 328.23
		txn92.card = zf_CARD1
		txn92.type = "S"
		txn92.currency = "SGD"
		cal.set(2012,7 , 7)
		txn92.txnDate = cal.getTime()
		txn92.merchant = NTU
		txn92.description = ""
		txn92.save()

		def txn93 = new Transaction()
		txn93.amount = 845.26
		txn93.card = zd_CARD1
		txn93.type = "S"
		txn93.currency = "SGD"
		cal.set(2012,7 , 7)
		txn93.txnDate = cal.getTime()
		txn93.merchant = NUS
		txn93.description = ""
		txn93.save()

		def txn94 = new Transaction()
		txn94.amount = 814.37
		txn94.card = zf_CARD5
		txn94.type = "S"
		txn94.currency = "SGD"
		cal.set(2012,3 , 8)
		txn94.txnDate = cal.getTime()
		txn94.merchant = APPLE
		txn94.description = ""
		txn94.save()

		def txn95 = new Transaction()
		txn95.amount = 558.26
		txn95.card = gy_CARD3
		txn95.type = "S"
		txn95.currency = "SGD"
		cal.set(2012,6 , 25)
		txn95.txnDate = cal.getTime()
		txn95.merchant = SAMSUNG
		txn95.description = ""
		txn95.save()

		def txn96 = new Transaction()
		txn96.amount = 360.80
		txn96.card = zf_CARD2
		txn96.type = "S"
		txn96.currency = "SGD"
		cal.set(2012,11 , 26)
		txn96.txnDate = cal.getTime()
		txn96.merchant = NUS
		txn96.description = ""
		txn96.save()

		def txn97 = new Transaction()
		txn97.amount = 664.32
		txn97.card = zf_CARD5
		txn97.type = "S"
		txn97.currency = "SGD"
		cal.set(2012,6 , 9)
		txn97.txnDate = cal.getTime()
		txn97.merchant = NTU
		txn97.description = ""
		txn97.save()

		def txn98 = new Transaction()
		txn98.amount = 931.55
		txn98.card = zf_CARD1
		txn98.type = "S"
		txn98.currency = "SGD"
		cal.set(2012,9 , 10)
		txn98.txnDate = cal.getTime()
		txn98.merchant = SMU
		txn98.description = ""
		txn98.save()

		def txn99 = new Transaction()
		txn99.amount = 873.15
		txn99.card = zf_CARD1
		txn99.type = "S"
		txn99.currency = "SGD"
		cal.set(2012,4 , 25)
		txn99.txnDate = cal.getTime()
		txn99.merchant = NTU
		txn99.description = ""
		txn99.save()

		def txn100 = new Transaction()
		txn100.amount = 293.12
		txn100.card = zd_CARD5
		txn100.type = "S"
		txn100.currency = "SGD"
		cal.set(2012,10 , 17)
		txn100.txnDate = cal.getTime()
		txn100.merchant = NUS
		txn100.description = ""
		txn100.save()

		def txn101 = new Transaction()
		txn101.amount = 116.66
		txn101.card = gy_CARD2
		txn101.type = "S"
		txn101.currency = "SGD"
		cal.set(2012,6 , 4)
		txn101.txnDate = cal.getTime()
		txn101.merchant = ADIDAS
		txn101.description = ""
		txn101.save()

		def txn102 = new Transaction()
		txn102.amount = 852.85
		txn102.card = zf_CARD1
		txn102.type = "S"
		txn102.currency = "SGD"
		cal.set(2012,11 , 6)
		txn102.txnDate = cal.getTime()
		txn102.merchant = STARBUCKS
		txn102.description = ""
		txn102.save()

		def txn103 = new Transaction()
		txn103.amount = 909.63
		txn103.card = gy_CARD3
		txn103.type = "S"
		txn103.currency = "SGD"
		cal.set(2012,6 , 18)
		txn103.txnDate = cal.getTime()
		txn103.merchant = SAKAE_SUSHI
		txn103.description = ""
		txn103.save()

		def txn104 = new Transaction()
		txn104.amount = 706.57
		txn104.card = gy_CARD1
		txn104.type = "S"
		txn104.currency = "SGD"
		cal.set(2012,5 , 11)
		txn104.txnDate = cal.getTime()
		txn104.merchant = NUS
		txn104.description = ""
		txn104.save()

		def txn105 = new Transaction()
		txn105.amount = 959.34
		txn105.card = gy_CARD4
		txn105.type = "S"
		txn105.currency = "SGD"
		cal.set(2012,10 , 9)
		txn105.txnDate = cal.getTime()
		txn105.merchant = CONVERSE
		txn105.description = ""
		txn105.save()

		def txn106 = new Transaction()
		txn106.amount = 533.89
		txn106.card = zf_CARD4
		txn106.type = "S"
		txn106.currency = "SGD"
		cal.set(2012,4 , 24)
		txn106.txnDate = cal.getTime()
		txn106.merchant = CITY_CHAIN
		txn106.description = ""
		txn106.save()

		def txn107 = new Transaction()
		txn107.amount = 533.00
		txn107.card = gy_CARD2
		txn107.type = "S"
		txn107.currency = "SGD"
		cal.set(2012,6 , 25)
		txn107.txnDate = cal.getTime()
		txn107.merchant = STARBUCKS
		txn107.description = ""
		txn107.save()

		def txn108 = new Transaction()
		txn108.amount = 450.39
		txn108.card = gy_CARD1
		txn108.type = "S"
		txn108.currency = "SGD"
		cal.set(2012,6 , 4)
		txn108.txnDate = cal.getTime()
		txn108.merchant = CONVERSE
		txn108.description = ""
		txn108.save()

		def txn109 = new Transaction()
		txn109.amount = 746.53
		txn109.card = zd_CARD1
		txn109.type = "S"
		txn109.currency = "SGD"
		cal.set(2012,11 , 15)
		txn109.txnDate = cal.getTime()
		txn109.merchant = APPLE
		txn109.description = ""
		txn109.save()

		def txn110 = new Transaction()
		txn110.amount = 245.72
		txn110.card = gy_CARD4
		txn110.type = "S"
		txn110.currency = "SGD"
		cal.set(2012,10 , 26)
		txn110.txnDate = cal.getTime()
		txn110.merchant = SAKAE_SUSHI
		txn110.description = ""
		txn110.save()

		def txn111 = new Transaction()
		txn111.amount = 472.24
		txn111.card = zf_CARD2
		txn111.type = "S"
		txn111.currency = "SGD"
		cal.set(2012,3 , 6)
		txn111.txnDate = cal.getTime()
		txn111.merchant = COFFEE_BEAN
		txn111.description = ""
		txn111.save()

		def txn112 = new Transaction()
		txn112.amount = 997.76
		txn112.card = gy_CARD3
		txn112.type = "S"
		txn112.currency = "SGD"
		cal.set(2012,4 , 26)
		txn112.txnDate = cal.getTime()
		txn112.merchant = SMU
		txn112.description = ""
		txn112.save()

		def txn113 = new Transaction()
		txn113.amount = 748.18
		txn113.card = gy_CARD5
		txn113.type = "S"
		txn113.currency = "SGD"
		cal.set(2012,7 , 18)
		txn113.txnDate = cal.getTime()
		txn113.merchant = NTU
		txn113.description = ""
		txn113.save()

		def txn114 = new Transaction()
		txn114.amount = 260.99
		txn114.card = zf_CARD1
		txn114.type = "S"
		txn114.currency = "SGD"
		cal.set(2012,7 , 16)
		txn114.txnDate = cal.getTime()
		txn114.merchant = COFFEE_BEAN
		txn114.description = ""
		txn114.save()

		def txn115 = new Transaction()
		txn115.amount = 609.66
		txn115.card = zf_CARD5
		txn115.type = "S"
		txn115.currency = "SGD"
		cal.set(2012,8 , 13)
		txn115.txnDate = cal.getTime()
		txn115.merchant = CITY_CHAIN
		txn115.description = ""
		txn115.save()

		def txn116 = new Transaction()
		txn116.amount = 784.48
		txn116.card = zf_CARD2
		txn116.type = "S"
		txn116.currency = "SGD"
		cal.set(2012,5 , 6)
		txn116.txnDate = cal.getTime()
		txn116.merchant = COFFEE_BEAN
		txn116.description = ""
		txn116.save()

		def txn117 = new Transaction()
		txn117.amount = 575.24
		txn117.card = gy_CARD5
		txn117.type = "S"
		txn117.currency = "SGD"
		cal.set(2012,3 , 19)
		txn117.txnDate = cal.getTime()
		txn117.merchant = APPLE
		txn117.description = ""
		txn117.save()

		def txn118 = new Transaction()
		txn118.amount = 800.25
		txn118.card = zf_CARD2
		txn118.type = "S"
		txn118.currency = "SGD"
		cal.set(2012,8 , 10)
		txn118.txnDate = cal.getTime()
		txn118.merchant = CONVERSE
		txn118.description = ""
		txn118.save()

		def txn119 = new Transaction()
		txn119.amount = 431.66
		txn119.card = zd_CARD3
		txn119.type = "S"
		txn119.currency = "SGD"
		cal.set(2012,9 , 3)
		txn119.txnDate = cal.getTime()
		txn119.merchant = ADIDAS
		txn119.description = ""
		txn119.save()

		def txn120 = new Transaction()
		txn120.amount = 204.59
		txn120.card = zd_CARD3
		txn120.type = "S"
		txn120.currency = "SGD"
		cal.set(2012,11 , 10)
		txn120.txnDate = cal.getTime()
		txn120.merchant = CITY_CHAIN
		txn120.description = ""
		txn120.save()

		def txn121 = new Transaction()
		txn121.amount = 431.56
		txn121.card = gy_CARD1
		txn121.type = "S"
		txn121.currency = "SGD"
		cal.set(2012,3 , 12)
		txn121.txnDate = cal.getTime()
		txn121.merchant = STARBUCKS
		txn121.description = ""
		txn121.save()

		def txn122 = new Transaction()
		txn122.amount = 488.31
		txn122.card = gy_CARD1
		txn122.type = "S"
		txn122.currency = "SGD"
		cal.set(2012,3 , 17)
		txn122.txnDate = cal.getTime()
		txn122.merchant = BHG
		txn122.description = ""
		txn122.save()

		def txn123 = new Transaction()
		txn123.amount = 562.63
		txn123.card = zf_CARD3
		txn123.type = "S"
		txn123.currency = "SGD"
		cal.set(2012,3 , 18)
		txn123.txnDate = cal.getTime()
		txn123.merchant = BHG
		txn123.description = ""
		txn123.save()

		def txn124 = new Transaction()
		txn124.amount = 290.69
		txn124.card = gy_CARD4
		txn124.type = "S"
		txn124.currency = "SGD"
		cal.set(2012,11 , 25)
		txn124.txnDate = cal.getTime()
		txn124.merchant = COFFEE_BEAN
		txn124.description = ""
		txn124.save()

		def txn125 = new Transaction()
		txn125.amount = 864.88
		txn125.card = zf_CARD2
		txn125.type = "S"
		txn125.currency = "SGD"
		cal.set(2012,7 , 20)
		txn125.txnDate = cal.getTime()
		txn125.merchant = SMU
		txn125.description = ""
		txn125.save()

		def txn126 = new Transaction()
		txn126.amount = 993.41
		txn126.card = gy_CARD4
		txn126.type = "S"
		txn126.currency = "SGD"
		cal.set(2012,7 , 27)
		txn126.txnDate = cal.getTime()
		txn126.merchant = ROBINSON
		txn126.description = ""
		txn126.save()

		def txn127 = new Transaction()
		txn127.amount = 857.07
		txn127.card = zf_CARD1
		txn127.type = "S"
		txn127.currency = "SGD"
		cal.set(2012,7 , 6)
		txn127.txnDate = cal.getTime()
		txn127.merchant = CITY_CHAIN
		txn127.description = ""
		txn127.save()

		def txn128 = new Transaction()
		txn128.amount = 986.36
		txn128.card = zd_CARD2
		txn128.type = "S"
		txn128.currency = "SGD"
		cal.set(2012,5 , 16)
		txn128.txnDate = cal.getTime()
		txn128.merchant = COFFEE_BEAN
		txn128.description = ""
		txn128.save()

		def txn129 = new Transaction()
		txn129.amount = 884.98
		txn129.card = zf_CARD2
		txn129.type = "S"
		txn129.currency = "SGD"
		cal.set(2012,8 , 6)
		txn129.txnDate = cal.getTime()
		txn129.merchant = SMU
		txn129.description = ""
		txn129.save()

		def txn130 = new Transaction()
		txn130.amount = 435.49
		txn130.card = zf_CARD2
		txn130.type = "S"
		txn130.currency = "SGD"
		cal.set(2012,10 , 7)
		txn130.txnDate = cal.getTime()
		txn130.merchant = SMU
		txn130.description = ""
		txn130.save()

		def txn131 = new Transaction()
		txn131.amount = 248.43
		txn131.card = zf_CARD2
		txn131.type = "S"
		txn131.currency = "SGD"
		cal.set(2012,11 , 22)
		txn131.txnDate = cal.getTime()
		txn131.merchant = ROBINSON
		txn131.description = ""
		txn131.save()

		def txn132 = new Transaction()
		txn132.amount = 789.58
		txn132.card = gy_CARD4
		txn132.type = "S"
		txn132.currency = "SGD"
		cal.set(2012,3 , 27)
		txn132.txnDate = cal.getTime()
		txn132.merchant = APPLE
		txn132.description = ""
		txn132.save()

		def txn133 = new Transaction()
		txn133.amount = 856.86
		txn133.card = zd_CARD1
		txn133.type = "S"
		txn133.currency = "SGD"
		cal.set(2012,7 , 14)
		txn133.txnDate = cal.getTime()
		txn133.merchant = SMU
		txn133.description = ""
		txn133.save()

		def txn134 = new Transaction()
		txn134.amount = 573.36
		txn134.card = zd_CARD2
		txn134.type = "S"
		txn134.currency = "SGD"
		cal.set(2012,10 , 3)
		txn134.txnDate = cal.getTime()
		txn134.merchant = SAMSUNG
		txn134.description = ""
		txn134.save()

		def txn135 = new Transaction()
		txn135.amount = 286.87
		txn135.card = zd_CARD1
		txn135.type = "S"
		txn135.currency = "SGD"
		cal.set(2012,3 , 18)
		txn135.txnDate = cal.getTime()
		txn135.merchant = SAMSUNG
		txn135.description = ""
		txn135.save()

		def txn136 = new Transaction()
		txn136.amount = 337.23
		txn136.card = zf_CARD2
		txn136.type = "S"
		txn136.currency = "SGD"
		cal.set(2012,3 , 24)
		txn136.txnDate = cal.getTime()
		txn136.merchant = CITY_CHAIN
		txn136.description = ""
		txn136.save()

		def txn137 = new Transaction()
		txn137.amount = 596.19
		txn137.card = zf_CARD2
		txn137.type = "S"
		txn137.currency = "SGD"
		cal.set(2012,6 , 5)
		txn137.txnDate = cal.getTime()
		txn137.merchant = SAMSUNG
		txn137.description = ""
		txn137.save()

		def txn138 = new Transaction()
		txn138.amount = 898.45
		txn138.card = zf_CARD2
		txn138.type = "S"
		txn138.currency = "SGD"
		cal.set(2012,11 , 3)
		txn138.txnDate = cal.getTime()
		txn138.merchant = COFFEE_BEAN
		txn138.description = ""
		txn138.save()

		def txn139 = new Transaction()
		txn139.amount = 626.09
		txn139.card = zf_CARD3
		txn139.type = "S"
		txn139.currency = "SGD"
		cal.set(2012,9 , 26)
		txn139.txnDate = cal.getTime()
		txn139.merchant = SMU
		txn139.description = ""
		txn139.save()

		def txn140 = new Transaction()
		txn140.amount = 240.73
		txn140.card = zf_CARD2
		txn140.type = "S"
		txn140.currency = "SGD"
		cal.set(2012,5 , 19)
		txn140.txnDate = cal.getTime()
		txn140.merchant = COFFEE_BEAN
		txn140.description = ""
		txn140.save()

		def txn141 = new Transaction()
		txn141.amount = 755.11
		txn141.card = zd_CARD3
		txn141.type = "S"
		txn141.currency = "SGD"
		cal.set(2012,5 , 3)
		txn141.txnDate = cal.getTime()
		txn141.merchant = SAKAE_SUSHI
		txn141.description = ""
		txn141.save()

		def txn142 = new Transaction()
		txn142.amount = 589.83
		txn142.card = zf_CARD4
		txn142.type = "S"
		txn142.currency = "SGD"
		cal.set(2012,11 , 24)
		txn142.txnDate = cal.getTime()
		txn142.merchant = STARBUCKS
		txn142.description = ""
		txn142.save()

		def txn143 = new Transaction()
		txn143.amount = 946.59
		txn143.card = zf_CARD5
		txn143.type = "S"
		txn143.currency = "SGD"
		cal.set(2012,9 , 15)
		txn143.txnDate = cal.getTime()
		txn143.merchant = NUS
		txn143.description = ""
		txn143.save()

		def txn144 = new Transaction()
		txn144.amount = 458.43
		txn144.card = zf_CARD1
		txn144.type = "S"
		txn144.currency = "SGD"
		cal.set(2012,11 , 19)
		txn144.txnDate = cal.getTime()
		txn144.merchant = SMU
		txn144.description = ""
		txn144.save()

		def txn145 = new Transaction()
		txn145.amount = 842.90
		txn145.card = gy_CARD4
		txn145.type = "S"
		txn145.currency = "SGD"
		cal.set(2012,11 , 10)
		txn145.txnDate = cal.getTime()
		txn145.merchant = BHG
		txn145.description = ""
		txn145.save()

		def txn146 = new Transaction()
		txn146.amount = 690.17
		txn146.card = gy_CARD5
		txn146.type = "S"
		txn146.currency = "SGD"
		cal.set(2012,11 , 4)
		txn146.txnDate = cal.getTime()
		txn146.merchant = SMU
		txn146.description = ""
		txn146.save()

		def txn147 = new Transaction()
		txn147.amount = 210.60
		txn147.card = zd_CARD3
		txn147.type = "S"
		txn147.currency = "SGD"
		cal.set(2012,3 , 5)
		txn147.txnDate = cal.getTime()
		txn147.merchant = SMU
		txn147.description = ""
		txn147.save()

		def txn148 = new Transaction()
		txn148.amount = 319.08
		txn148.card = zf_CARD2
		txn148.type = "S"
		txn148.currency = "SGD"
		cal.set(2012,9 , 5)
		txn148.txnDate = cal.getTime()
		txn148.merchant = COFFEE_BEAN
		txn148.description = ""
		txn148.save()

		def txn149 = new Transaction()
		txn149.amount = 294.09
		txn149.card = zd_CARD3
		txn149.type = "S"
		txn149.currency = "SGD"
		cal.set(2012,5 , 6)
		txn149.txnDate = cal.getTime()
		txn149.merchant = BHG
		txn149.description = ""
		txn149.save()

		def txn150 = new Transaction()
		txn150.amount = 654.38
		txn150.card = zf_CARD2
		txn150.type = "S"
		txn150.currency = "SGD"
		cal.set(2012,10 , 8)
		txn150.txnDate = cal.getTime()
		txn150.merchant = SAKAE_SUSHI
		txn150.description = ""
		txn150.save()

		def txn151 = new Transaction()
		txn151.amount = 879.88
		txn151.card = zf_CARD2
		txn151.type = "S"
		txn151.currency = "SGD"
		cal.set(2012,8 , 26)
		txn151.txnDate = cal.getTime()
		txn151.merchant = NUS
		txn151.description = ""
		txn151.save()

		def txn152 = new Transaction()
		txn152.amount = 644.63
		txn152.card = gy_CARD4
		txn152.type = "S"
		txn152.currency = "SGD"
		cal.set(2012,11 , 16)
		txn152.txnDate = cal.getTime()
		txn152.merchant = BHG
		txn152.description = ""
		txn152.save()

		def txn153 = new Transaction()
		txn153.amount = 700.20
		txn153.card = gy_CARD3
		txn153.type = "S"
		txn153.currency = "SGD"
		cal.set(2012,4 , 6)
		txn153.txnDate = cal.getTime()
		txn153.merchant = COFFEE_BEAN
		txn153.description = ""
		txn153.save()

		def txn154 = new Transaction()
		txn154.amount = 158.75
		txn154.card = zf_CARD3
		txn154.type = "S"
		txn154.currency = "SGD"
		cal.set(2012,3 , 21)
		txn154.txnDate = cal.getTime()
		txn154.merchant = SMU
		txn154.description = ""
		txn154.save()
		
		println "finish setupTransaction"
	}
	
	def setupRedemption() {
		
		def voucher0 = Voucher.findById(1)
		def redemption = new Redemption()
		redemption.user = ZHONGDE
		redemption.status = com.mastercard.labs.Redemption.Status.FAIL.toString()
		redemption.voucher = voucher0
		
		redemption.rdptDate = new Date() -10
		redemption.quantity = 100
		
		redemption.save()
		
		def voucher1 = Voucher.findById(2)
		def redemption1 = new Redemption()
		redemption1.user = ZHONGDE
		redemption1.status = com.mastercard.labs.Redemption.Status.SUCCESS.value
		redemption1.voucher = voucher1
		
		redemption1.rdptDate = new Date() - 9
		redemption1.quantity = 100
		
		redemption1.save()
		
		def voucher2 = Voucher.findById(3)
		def redemption2 = new Redemption()
		redemption2.user = ZHONGDE
		redemption2.status = com.mastercard.labs.Redemption.Status.PROCESSING.value
		redemption2.voucher = voucher2
		
		redemption2.rdptDate = new Date() - 8
		redemption2.quantity = 100
		
		redemption2.save()
		
		def voucher3 = Voucher.findById(4)
		def redemption3 = new Redemption()
		redemption3.user = ZIFENG
		redemption3.status = com.mastercard.labs.Redemption.Status.SUCCESS.value
		redemption3.voucher = voucher3
		
		redemption3.rdptDate = new Date() - 7
		redemption3.quantity = 100
		
		redemption3.save()
		
		def voucher4 = Voucher.findById(5)
		def redemption4 = new Redemption()
		redemption4.user = ZIFENG
		redemption4.status = com.mastercard.labs.Redemption.Status.FAIL.value
		redemption4.voucher = voucher4
		
		redemption4.rdptDate = new Date() - 6
		redemption4.quantity = 100
		
		redemption4.save()
		
		RewardPoint rp = new RewardPoint ()
		rp.user = GUOYU
		rp.point = 10000
		rp.save()
		println "finish setupRedemption"
	}
	 

	private safelyAddPermission(entity, String permission) {
		if (!entity.permissions?.contains(permission)) {
			entity.addToPermissions permission
		}
	}
}
